1. #1
    Ext User
    Join Date
    Nov 2008
    Posts
    6
    Vote Rating
    0
    rencarl is on a distinguished road

      0  

    Default How to add checkboxes at a specific form place

    How to add checkboxes at a specific form place


    Hi,
    i want to add some checkboxes, generated dynamically, to a specific place in a form. I know how to add the checkboxes, but i don't know how to add them to e specific place.

    [code] var itemsTypeOfLodgings = [{xtype: 'label', text: 'Art der Unterkunft', cls:'x-form-check-group-label', anchor:'-15'}];
    var ajaxTypeOfLodgings = new Ext.data.Connection({});
    ajaxTypeOfLodgings.request({
    url: 'test.ajax.php',
    success: function(r, o){
    obj = eval(r.responseText);
    var len = obj.length;
    for(var x = 0; x < len; x++) {
    cb = new Ext.form.Checkbox({
    hideLabel: true,
    name: 'arrTypeOfLodgings[]',
    boxLabel: obj[x].boxLabel,
    value: obj[x].inputValue
    });
    frmVac.add(cb);
    }
    frmVac.doLayout();
    },
    failure: function(r, o){
    //alert('Fehler');
    },
    params: {action: 'getLodgings'}
    });

    frmVac = new Ext.form.FormPanel({
    id: 'frmVac',
    layout: 'form',
    labelWidth: 330, // label settings here cascade unless overridden
    frame:true,
    title: 'Suche',
    bodyStyle:'padding:5px 5px 0',
    width: 600,
    defaults: {
    width: 100,
    allowBlank:false,
    format: 'd.m.Y'
    },
    defaultType: 'datefield',
    items: [{
    xtype: 'numberfield',
    fieldLabel: 'Dauer des Aufenthalts',
    id: 'vacNights',
    allowBlank: true
    },{
    fieldLabel: 'Anreise',
    id: 'vacStart'
    },{
    fieldLabel: 'Abreise',
    id: 'vacEnd',
    allowBlank: true
    },{
    xtype:'fieldset',
    width: 600,
    checkboxToggle:true,
    collapsed: false,
    title: 'erweiterte Suchm

  2. #2
    Ext User
    Join Date
    Nov 2008
    Posts
    6
    Vote Rating
    0
    rencarl is on a distinguished road

      0  

    Default


    Ok, i can create my checkboxes before i render the form, it works, but it would be interesting for me how to add checkboxes somewhere in a large form, f. e. under a specific panel.

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    97
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You could use:
    Code:
    // Insert checkbox into panel
    panel.insert(position, checkbox);
    panel.doLayout();
    // Add checkbox to fields list.
    form.getForm().add(checkbox);

Thread Participants: 1