Results 1 to 4 of 4

Thread: ComboBox with JsonStore not displaying text of entries but entries exist

  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2009
    Posts
    21

    Default ComboBox with JsonStore not displaying text of entries but entries exist

    I am using ExtJS 3.2.1 and am having an issue when populating Ext.form.ComboBox with a Ext.data.JsonStore. The JsonStore receives the data from the server fine and without error, but when I click the expand button on the ComboBox it just shows skinny empty entries where there should be text values. I have this working with another customer and have tripple checked to see where the issue might be. I think I might just need another set of eyes.

    Here is the simple page:

    Code:
    Ext.onReady(function(){   
    	   
      store1 = new Ext.data.JsonStore({
    	autoLoad:true,
    	proxy: new Ext.data.HttpProxy({url:'/rpgui/ldlst', method:'POST'}),
    	baseParams: {action:'FN4110', MNAM:'', TCDE:'MS'},	  
    	root: 'list',
    	fields: ['vfld','dfld']
      });	   
    	   
      var fp = new Ext.FormPanel({
        title:'Form Title',
        items:[
          new Ext.form.ComboBox({
            store:store1, 
            valueField:'vfld', 
    	displayField:'dfld',
    	triggerAction:'all',
          })
        ]
      });    
    
        fp.render(document.body);
        
    });
    Here is the raw JSON returned from the server:

    Code:
    { "list":[ { "D":"Divorced" } , { "DP":"Domestic Partner" } , { "M":"Married" } , { "S":"Single" } , { "SE":"Separated" } , { "W":"Widow/Widower" } ] , "success":true , "msg":"                                                  " }
    If I do a Ext.data.SimpleStore then there are values in the ComboBox:
    Code:
    new Ext.form.ComboBox({
      store: new Ext.data.SimpleStore({
        fields: ['key', 'value'],
        data: [['D', 'Divorced'],['DP', 'Domestic Parnter'], 
                  ['M', 'Married'],['S', 'Single'],
                  ['SE', 'Separated'],['W', 'Window/Windower']]
       }), 
      valueField:'key', 
      displayField:'value',
      mode:'local',
      triggerAction:'all',
    })
    Thanks for any help,
    AaronBartell.com
    RPG+DB2+IBMi+ExtJS=Goodness

  2. #2
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default

    Your json should look like (based on your fields):

    Code:
    { "list":[ { "vfld": "D", "dfld" : "Divorced" } , { "vfld": "DP", "dfld" :"Domestic Partner" }, ....

  3. #3
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    You're missing "mode: 'local'" from your first config. Also, watch out for trailing commas: "triggerAction:'all',"

    EDIT: And, more importantly, what mankz ^^ says

  4. #4
    Ext JS Premium Member
    Join Date
    Nov 2009
    Posts
    21

    Default

    Quote Originally Posted by mankz View Post
    Your json should look like (based on your fields):

    Code:
    { "list":[ { "vfld": "D", "dfld" : "Divorced" } , { "vfld": "DP", "dfld" :"Domestic Partner" }, ....
    My goodness do I feel stupid. Thanks for the quick response. It is now working. The difference from my previous implementation of this is that I was only passing back a single entry in each array element (i.e. only a displayField value and not a valueField value).

    Thx again,
    AaronBartell.com
    RPG+DB2+IBMi+ExtJS=Goodness

Similar Threads

  1. [2.0.1-2.1] New ComboBox entries in EditorGrid
    By ohhowihateie in forum Ext 2.x: Bugs
    Replies: 13
    Last Post: 23 Feb 2009, 7:39 AM
  2. displaying 100 thousand entries from an array
    By nokia786 in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 2 Jan 2009, 8:41 AM
  3. Combobox that automatically adds text entries into itself?
    By weyus in forum Community Discussion
    Replies: 1
    Last Post: 3 Jul 2008, 3:28 AM
  4. New ComboBox Entries in EditorGrid
    By ohhowihateie in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 9 May 2008, 6:18 AM

Posting Permissions

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