PDA

View Full Version : ServerProxy URL



alejandroNNU
23 May 2014, 2:00 PM
I am very confused by an error I am getting with the following XML store:


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:
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:


{
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:

49107
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.

alejandroNNU
24 May 2014, 1:55 PM
Does anyone have an idea on how I may be able to fix this? Please help.

skirtle
24 May 2014, 5:34 PM
You shouldn't be using an Ajax proxy if you don't intend to do any loading via AJAX through the proxy. You probably just need a Memory proxy.

However, your main problem is you're missing this line on your combobox:


queryMode: 'local'

Without this line the combobox will attempt to load the combobox's store.

alejandroNNU
24 May 2014, 6:26 PM
thanks for your answer Skirtle, i had no idea about queryMode, that fixed it, thank you.