Results 1 to 3 of 3

Thread: Urgent Help on Loading DB values to Json store

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    18

    Default Answered: Urgent Help on Loading DB values to Json store

    I need to load db values to a combo box for multi selection. I can't figure out, why values are not loading into combo box. By firebug, console.log values are printed out. Here is my code for multiselect combo box,

    Code:
    var groups = new Ext.data.JsonStore({      
         fields: [                          
                { id: 'id' },   
               { name: 'name' }       
             ],                                
             root:  'rows',                           
            autoDestroy: true,                               
            autoLoad: true,                           
           proxy: new Ext.data.HttpProxy({                     
                     url :  GO.settings.modules.schedule.url + 'groups.php',      
          }),                               
       reader: {               
        type:  'json',                  
       root: 'rows'            
       },               
     listeners: {           
          load: function(obj, records){           
               Ext.each(records, function(rec){               
               console.log(rec.get('name'));                     });                 }              } });                                                   var  taskGroup = new Ext.form.ComboBox({                   
      name : 'Group',                      
    hiddenName : 'group',                     
     triggerAction : 'all',                     
     editable :  false,                     
     fieldLabel : 'Group',                     
     mode : 'local',                   
     autoLoad: true,                      
    displayField : 'text',                     
    store :  groups,                      
    columns: [                 {                      dataIndex: 'name'                 }             ],                  });

  2. Hi rxbass,

    var groups = new Ext.data.JsonStore({ fields: [ { id: 'id' }, { name: 'name' } ],
    Change fields config like -
    Code:
      fields: [{name: 'id'}, {name: 'name'}]
    Add displayField and valueField config into your combobox, like-
    Code:
    xtype:'combo'
    , hiddenName: 'sample'
    , displayField:'name'
    , valueField:'id'
    .................

  3. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124

    Default

    Hi rxbass,

    var groups = new Ext.data.JsonStore({ fields: [ { id: 'id' }, { name: 'name' } ],
    Change fields config like -
    Code:
      fields: [{name: 'id'}, {name: 'name'}]
    Add displayField and valueField config into your combobox, like-
    Code:
    xtype:'combo'
    , hiddenName: 'sample'
    , displayField:'name'
    , valueField:'id'
    .................
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    18

    Default

    Perfect...Works fine.. for multiselect?

Tags for this Thread

Posting Permissions

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