Results 1 to 6 of 6

Thread: Ext JS4: Combobox options not being displayed

  1. #1

    Default Ext JS4: Combobox options not being displayed

    Hi

    I have a combobox in the form panel. Initially I had used Ext.data.SimpleStore and now I changed it to Ext.data.Store. After making this change,the values in my combobox are not being displayed.. However, when I press down key to check the values..the number of rows present is right..( I tried changing the store to 3 elements and checked ) only the text is not visible since the height of the row is too less I think.
    So, someone please help me to fix it.
    Code:
          {
    			        	  name : 'cName',
    			        	  xtype : 'combobox',
    			        	  displayField : 'name',
    				      		valueField : 'code', 
    				      	
    			      		  store : new Ext.data.Store({
    			      			fields : [ 'code', 'name' ],
    			      			data : [ [ '1', 'ABCD' ],
    			      					[ '2', 'EFGH' ],
    			      					[ '3', 'IJKL' ] ,
    			      					['4','MNOP']
    			      			]
    			      		}),
    			      		
    			        	
    			          }
    Thanks

  2. #2
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579
    Answers
    67

    Default

    The store you are now using defaults to using a json reader. The data you have is still set up to be read by an array reader. You need to format your data as key value pairs.

  3. #3
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    707
    Answers
    25

    Default

    Or use an array reader, see code below. If you change to use a model instead of specifying fields on the store, it will help with migration to ExtJS 5.x.

    Code:
     var mystore = new Ext.data.Store({
         reader: {
             type: 'array'
         },
         fields: ['code', 'name'],
         data: [
             ['1', 'ABCD'],
             ['2', 'EFGH'],
             ['3', 'IJKL'],
             ['4', 'MNOP']
         ]
    
     });
    
     console.log(mystore.count());
     mystore.each(function(what) {
         console.log(what.data);
     });
    Last edited by carol.ext; 6 Nov 2014 at 9:07 AM. Reason: Add note about using model.

  4. #4

    Default I will try that.

    Quote Originally Posted by Tim Toady View Post
    The store you are now using defaults to using a json reader. The data you have is still set up to be read by an array reader. You need to format your data as key value pairs.
    I have the same problem.

  5. #5

    Default The problem has been fixed.

    Quote Originally Posted by jianmin.liu View Post
    I have the same problem.
    I have fixed the problem.

  6. #6

    Default

    Thanks.

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
  •