Results 1 to 4 of 4

Thread: Store is Loaded but Combobox is blank ?

  1. #1
    Ext User srajakaruna's Avatar
    Join Date
    Apr 2008
    Location
    Sri Lanka
    Posts
    161

    Smile Store is Loaded but Combobox is blank ?

    Code:
    Ext.onReady(function(){
    
    	var _proxy = new Ext.data.HttpProxy({
    		url: 'get_store.php'
    	});
    	var _reader = new Ext.data.JsonReader({
    		root: 'myDir'
    		},['id', 'prop_name']
    	);
    	var _store = new Ext.data.Store({
    		proxy: _proxy,
    		reader: _reader,
    		baseParams:{scr: "destList"}
    	});
    	
    	var _selDes = new Ext.form.ComboBox({
    		editable: false,
    		name:'destination',
    		store: _store,
    		fieldLabel: 'Hotel',
    		displayField:'dest',
    		typeAhead: true,
    		mode: 'local',
    		triggerAction: 'all',
    		emptyText:'Select Destination ...',
    		selectOnFocus:true,
    		width:180
    	});	
    
        var simple = new Ext.FormPanel({
            labelWidth: 75, // label settings here cascade unless overridden
            url:'save-form.php',
            frame:true,
            title: 'Simple Form',
            bodyStyle:'padding:5px 5px 0',
            width: 350,
            defaults: {width: 230},
            defaultType: 'textfield',
    
            items: [_selDes]
        });
    
        simple.render(document.body);
        _store.load();
    
      // Json Output of this Example
      // {"myDir":[{"id":"1","prop_name":"America Hotel"},{"id":"1","prop_name":"India Hotel"}],"totalCount":2}
      
    });
    Combo box fills with 2 tiny blank options. I think its not picking the values in Store .. any Idea ? Thanks

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,240

    Default

    You need to specify a displayField and valueField on your combo.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Ext User srajakaruna's Avatar
    Join Date
    Apr 2008
    Location
    Sri Lanka
    Posts
    161

    Default Solved

    Thanks Evant

  4. #4
    Sencha User
    Join Date
    Aug 2008
    Posts
    5

    Default [2.2] Store is Loaded but Combobox is blank (FF OK but IE is blank)

    I habe an similar problem. With FF it works fine but with IE7 the combobox is empty.
    No errors, not to see where the problem is, the selection is empty



    Code:
    var ds = new Ext.data.Store({
      proxy: new Ext.data.HttpProxy({
      url: '/pad2/?fill=1'
      }),
         reader: new Ext.data.JsonReader({
         id: 'pkey',
         totalProperty: 'totalCount',
         root: 'fields'
      }, [
         {name: 'Field1', mapping: 'pkey'},
         {name: 'Field2', mapping: 'familyname'},
         {name: 'Field3', mapping: 'givenname'},
         {name: 'Field4', mapping: 'birthdate',type: 'date', dateFormat: 'Y-m-d'}
      ])
    });
     
    var search = new Ext.form.ComboBox({
      store: ds,
      displayField:'Field1',
      emptyText: 'Searchentry...',
      fieldLabel: 'Search',
      typeAhead: false,
      loadingText: 'Searching...',
      pageSize:10,
      hideTrigger:false,
      onSelect: function(record){
         Ext.Ajax.request({
            url: String.format('/pad2/?fill=1&pkey={0}&p={1}', record.data.Field1,record.id),
            success: funcOK,
            failure: funcFALSE
         });
      }
    });
    
    The Combobox is inside a viewport.

    thx for help

Posting Permissions

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