Mostrando entradas con la etiqueta create widget. Mostrar todas las entradas
Mostrando entradas con la etiqueta create widget. Mostrar todas las entradas

20 de mayo de 2015

Crear Widgets de forma dinamica

Aqui les dejo un snippet de como crear diferentes widget en js onRunTime, para ello tienen que apuntar a un container como por ejemplo un panel que estoy utilizando en el ejemplo:











Aqui el codigo

 buttonTextEditorClick: function(inSender) {
       this.layoutBox1.createComponent("someTextEditor", "wm.Text", {});
       this.someTextEditor.setDataValue("hola");
        this.layoutBox1.reflow();
    },
    buttonSelectEditorClick: function(inSender) {
        this.layoutBox1.createComponent("mySelect", "wm.SelectMenu", {});
        this.mySelect.setOptions("Rojo,Azul,Verde");
        this.layoutBox1.reflow();
    },
    buttonCheckBoxClick: function(inSender) {
        this.layoutBox1.createComponent("myCheckBox", "wm.Checkbox", {});
        this.myCheckBox.setCaption("El cHECK BOX");
        this.layoutBox1.reflow();
    },
    buttonRadioClick: function(inSender) {
        this.layoutBox1.createComponent("someRadio", "wm.RadioButton", {});
        this.layoutBox1.reflow();
    },
    buttonTextAreaClick: function(inSender) {
        this.layoutBox1.createComponent("textAreaEditor", "wm.LargeTextArea", {});
        this.layoutBox1.reflow();
    },
    buttonLabelClick: function(inSender) {
this.layoutBox1.createComponent("myLabel", "wm.Label", {});
        this.myLabel.setCaption("un ejemplo");
        this.layoutBox1.reflow();
},
buttonRadioSetClick: function(inSender) {
  this.layoutBox1.createComponent("myRadioSet", "wm.RadioSet", {});
        this.myRadioSet.setOptions("Masculino,Femenino,Otros");
        this.layoutBox1.reflow();
},
  buttonTextArea1Click: function(inSender) {
  this.panel1.createComponent("textAreaEditorPanel", "wm.LargeTextArea", {});
       this.textAreaEditorPanel.setCaption("mucho texto");
        this.panel1.reflow();
},
  buttonRichTextClick: function(inSender) {
   this.layoutBox1.createComponent("richText", "wm.RichText", {});
        this.layoutBox1.reflow();
},
  buttonDateClick: function(inSender) {
 this.layoutBox1.createComponent("dateEditor1", "wm.Date", {});
        this.layoutBox1.reflow();
},
  buttonDojoUploadClick: function(inSender) {
this.panel1.createComponent("dojoUpload", "wm.DojoFileUpload", {});
        this.panel1.reflow();
},

Espero que les sirva.


Mis cosas

Powered By Blogger