Results 1 to 3 of 3

Thread: generate a radiogroup from a JsonStore

  1. #1

    Default generate a radiogroup from a JsonStore

    Hi everyone,

    I'm trying to generate a radiogroup from a JsonStore.

    this is my Json Store :

    Code:
                    var ds = new Ext.data.JsonStore({
                        proxy : new Ext.data.HttpProxy({
                                method: 'POST',
                                timeout:500000,
                                prettyUrls: false,
                                url: '<%=contextPath%>/choixProfil/chargerChoix.action'
                                }),
                        root: 'data',
                        totalProperty: 'count',
                        fields: [{name: 'profil_id', type: 'int'},
                                 {name: 'profil', type: 'string'},
                             ],
                        writer: new Ext.data.JsonWriter(),
                        autoSave: false,
                        remoteSort: false
                    });
    
    


    and this is my container and my radiogroup :

    Code:
    conteneurPrincipal = new Ext.Container({ id:'formPrincipal', xtype: 'container', height: 250, width: 692, items: [ { xtype: 'radiogroup', fieldLabel: 'Profil', id:'ProfilFieldGroup', columns: 1, items: [{ boxLabel: 'boxLabel', inputValue: '0', name: 'name', checked: false }] } ], renderTo: Ext.getBody() });


    when my JsonStore is loaded, the radiogroup is modified :

    Code:
                ds.on('load', function(store, records, options) 
                    {
                      var rGroup = Ext.getCmp('ProfilFieldGroup');
                      rGroup.items.clear();
                      ds.each(function(record)   
                      {
                          rGroup.items.items.push(
                              new Ext.form.Radio({                  
                                boxLabel: record.data.profil,
                                inputValue: record.data.profil_id,
                                name: 'ProfilField',
                                checked: false
                              })
                            );
                      }, this); 
                      conteneurPrincipal.doLayout();
                });


    firebug shows that the rGroup has been modified and the radiogroup in conteneurPrincipal too but the doLayout has no effect.

    any advice please ?


  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    You will need to remove the radiogroup, build the items array and add a new radiogroup.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default

    Thank you !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •