vendredi 23 mai 2014

ServerProxy URL

I am very confused by an error I am getting with the following XML store:

Code:



Ext.define('MyApp.store.UserStore2', {
extend: 'Ext.data.Store',


requires: [
'MyApp.model.UserModel',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Xml'
],


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
model: 'MyApp.model.UserModel',
storeId: 'UserStore2',
proxy: {
type: 'ajax',
url: '',
reader: {
type: 'xml',
record: 'row'
}
}
}, cfg)]);
}
});

As you can see the proxy has no URL, this is because elsewhere in my app I send an AJAX call which returns an XML document that I place into the store by doing:

Code:



store.loadRawData(xmlDocument)

, so I shouldn't need a URL right?

I have associated this store with a grid panel and it works perfectly, the xml document gets loaded into the store and the records are displayed on the grid with no problems, but then I associate this very same store to a comboBox:



Code:



{
xtype: 'combobox',
itemId: 'categoryTypeField',
width: 405,
fieldLabel: 'Type',
displayField: 'username',
store: 'UserStore2',
valueField: 'username',
listeners: {
select: {
fn: me.onCategoryTypeFieldSelect,
scope: me
}
}
}

and as soon as I click on drop-down I get the following error: Ext.data.proxy.Server.buildUrl(): You are using a ServerProxy but have not supplied it with a url. and it gets stuck like this:

error.PNG

so clearly the records are getting loaded but then runs into this problem, I don't understand why it's giving me this error here but not with the grid panel, why does it require a URL all of a sudden? can someone please help me with this? it's halted progress with my entire app. If not then maybe some kind of workaround? all I need is to load records from the XML document I get back from the server so I can list them as value for this combo box, any help would be greatly appreciated.





Aucun commentaire:

Enregistrer un commentaire