-
16 Oct 2011 8:19 AM #1
Problem with DirectStore
Problem with DirectStore
Hello.
I am trying to use Direct b DirectStore in my application, but I have some problems with them.
I write in MVC style and add in my app.js file this:
This code work fine, but I try to define Model like this:Code:Ext.direct.Manager.addProvider({ 'type': 'remoting', 'url': '/places/remoting/router/', 'namespace': 'Recruitant.places', 'actions': { 'city': [ { 'formHandler': false, 'name': 'load_cities', 'len': 1 } ] } }); Recruitant.places.city.load_cities();
and DirectStore like this:Code:Ext.define('Recruitant.model.City', { extend: 'Ext.data.Model', proxy: { type: 'direct', url: '/places/remoting/router/', directFn: 'Recruitant.places.city.load_cities' }, fields: [ {name: 'id', type: 'int'}, {name: 'name', type: 'string'} ] });
and in my firebug have error "fn is undefined".Code:Ext.define('Recruitant.store.Cities', { extend: 'Ext.data.DirectStore', model: 'Recruitant.model.City' });
Help me to solve this problem, please.
-
17 Oct 2011 1:01 AM #2
My code works if I create grid, store and other objects in app.js, but it is not work if I write Store, Model and other stuff with Ext.define.
-
23 Oct 2011 10:33 PM #3
On the client side, remove the quotes around the directFn specification: it needs to be a function, not a strong.
You have:
directFn: 'Recruitant.places.city.load_cities'
You should have:
directFn: Recruitant.places.city.load_cities
-
5 Oct 2012 6:34 PM #4
@oniseijin - not true, docs say: "The directFn may also be a string reference to the fully qualified name of the function, for example: 'MyApp.company.GetProfile'. This can be useful when using dynamic loading. The string will be looked up when the proxy is created."
I am using it as a string in my application now and it is necessary in case the JS gets loaded out of order, although I have gotten intermittent errors about the directFn is null whether I use the string or function symbol format


Reply With Quote