PDA

View Full Version : Combo not load



pho3nix_
5 Apr 2008, 8:55 AM
I have this code



Ext.onReady(function() {

var myDataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: myExtHelper.hostname + '/Pages/Data/Category.aspx',
method: 'GET'
}),
baseParams: {
f: 'Combo'
},
reader: new Ext.data.XmlReader ({record: 'CmsCategory'}, ['IDCategory', 'Category'])}
);

myDataStore.load();

Ext.getCmp('cmbCategory').store = myDataStore;
Ext.getCmp('cmbCategory').hiddenName = 'IDCategory';
Ext.getCmp('cmbCategory').displayField = 'IDCategory';
Ext.getCmp('cmbCategory').valueField = 'Category';

});


and return this xml

[CODE]
<CMS>
<CmsCategory>
<IDCategory>1</IDCategory>
<Category>Apresenta

Condor
5 Apr 2008, 9:25 AM
How do you know it 'does not load' ? Loading is asynchronous, so the data won't be ready after you call load!

Here are some general pointers:
1. Is the encoding of the xml file text/xml or application/xml ?
2. store, hiddenName, displayField and valueField are not writeable properties, they are config options. They should be set in the constructors config parameter!

pho3nix_
5 Apr 2008, 10:49 AM
I changed my code to remove all properties of cmbCategory and changed to config in json parameters but continue not loading.

My xml data is of type text/xml

pho3nix_
5 Apr 2008, 10:58 AM
Problem solved.

mwh154
11 Apr 2008, 5:51 AM
Can you post your solution as this may help others including myself.

pho3nix_
12 Apr 2008, 7:40 AM
Can you post your solution as this may help others including myself.


I included in my combo json config this items:



{
id: 'cmbCategory',
xtype: "combo",
store: myDataStore,
hiddenName: 'IDCategory',
displayField: 'Category',
valueField: 'IDCategory',
fieldLabel: "Text",
name: "cmbCategory",
typeAhead: true,
mode: 'remote',
triggerAction: 'all',
width: '98%'
}