PDA

View Full Version : Combo list empty items



Webtel
27 Oct 2011, 10:44 PM
I have problem with combobox list items. I have following in one tbar.


{xtype:'combobox',name:'client_active', width:100,allowBlank:true, store:Factory.dict.client.active_search(), value:'1'}

Factory.dict.client.active_search() returns :


Ext.create('TS.lib.dict.Array',{
data:[['','(wszyscy)'],['1','Aktywny'],['0','Nieaktywny']]
});


TS.lib.dict.Array is:



Ext.define('TS.lib.dict.Array',{
extend:'Ext.data.ArrayStore',model:'TS.model.Dictionary', idIndex:0
});

TS.model.Dictionary is:


Ext.define('TS.model.Dictionary',{
extend:'Ext.data.Model',idProperty:'id',
fields: ['id','name']
});

After render. ComboList has 3 items(ok) BUT they are blank (and have about 4 pixels height)

Same issue is with JsonStore:
same model, data is loaded ok, right number of items are present in the dropdown - BUT all items are blank and clicking them makes field value null.

What am i missing or doing wrong? Previously i worked with Ext 3 and had very different approach to coding.

netemp
27 Oct 2011, 10:48 PM
Check that your model, and the JSON returned from the server, have same field names. The list generally appears blank when the key names are different in model from that present in JSON format from the server. Also, from your code, it seems that you also need to dispalyField and valueField configs to your combobox.

Webtel
27 Oct 2011, 11:13 PM
much thanks for help, you directed me toward solution. however, actualy my problem was more of an idiotic nature :) .. i defined those props on class with alias:combo and forgotten to require it (so i got default class instead) . Im playing with MVC dynamic loading for few days and still need some better understanding of it. (ext-dev.js notifications are not always helpfull)

netemp
28 Oct 2011, 12:34 AM
much thanks for help, you directed me toward solution. however, actualy my problem was more of an idiotic nature :) .. i defined those props on class with alias:combo and forgotten to require it (so i got default class instead) . Im playing with MVC dynamic loading for few days and still need some better understanding of it. (ext-dev.js notifications are not always helpfull)

Great that the issue got resolved. Would you please close this thread by choosing any one post as correct answer so that it doesn't appear in the list of questions which are unanswered.