PDA

View Full Version : Exception while loading data into store



tegti
28 Mar 2014, 2:19 AM
Hi,

I want to fill data in a store via a REST proxy. The store's autoload or load function in a controller throws the following exception:
Ext.data.proxy.Server.buildUrl(): You are using a ServerProxy but have not supplied it with a url.

I defined the proxy on the model object, like this:

Ext.define('Manager.model.Product', {
extend: 'Ext.data.Model',

config: {
fields: [
{
name: 'id',
type: 'string'
},
{
name: 'name',
type: 'string'
},
{
name: 'description',
type: 'string'
}
],
proxy: {
url: 'products.php',
type: 'rest',
reader: {
type: 'json'
}
}
}
});


The store with the autoload function like this:

Ext.define('Manager.store.Products', {
extend: 'Ext.data.Store',

config: {
autoLoad: true,
model: 'Manager.model.Product',
name: 'Products',
}
});
I am using Ext JS 4.2.2 and created the application with Sencha Tools Cmd 4.0.1.45.

What did I wrong? I am trying to find a solution since the last two days.

Regards,
tegti

scottmartin
28 Mar 2014, 6:32 AM
Remove the config:{} from both model/store and try again.

carol.ext
28 Mar 2014, 6:51 AM
I played around with your code in 4.2.1.

Not sure what the guidance is on what to put in config and what not to put in config, but if I take the proxy out of the config on your model, then the store's proxy ends up as type:rest with a defined url.

With the proxy in the config, the store's proxy ends up as type:ajax and url:undefined.

tegti
28 Mar 2014, 2:25 PM
It works.

Many thanks for your fast support.

I just took the code for the store from a Sencha Touch project. There it works fine. There is no need to use the config section.


Regards,
Joerg