Question

I have a grid and associated store which is used to display data about two different entities i.e. System and Customer . If the grid is shown after clicking on the System link, the url to use is /configuration/systemid/234 and if it is from customer link url should be /configuration/customerid/234. Note that the value 234 will also change. How can I achieve this in ExtJs4 MVC model.

is there a way to provide the url as below and replace the placeholders? url : '/configuration/{context}/{contextid}'

Or can I store the context in an object and use it here , like '/configuration/' + Context.type + '/' + Context.id

or is there a standard solution for this ?

The urls are given by backend dvlprs and can not be changed :(

i have the store defined as follows

Ext.define('MyApp.store.Configuration', {
extend: 'Ext.data.Store',
model: 'MyApp.model.Configuration',
autoLoad: true,
proxy: {
    type: 'ajax',
url : '/configuration/customerid/234'
}

})

thanks

Était-ce utile?

La solution

var yourStore = Ext.getStore('yourStoreID');
Context.type = customerid;
Context.id = 234;
yourStore.getProxy().setUrl('/configuration/' + Context.type + '/' + Context.id);

I have used something like this before, as my store had different urls for GET and POST. So dynamically you can easily change the URL.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top