PDA

View Full Version : How to extend DirectStore's api??? Besides CRUD I want to add new methods.



waterspeaker
20 Feb 2011, 8:00 PM
Hello all. I'm quite a newbie at extjs. I've been searching for this for quite long but haven't found an answer. How to extend DirectStore's api? I want to add new methods besides CRUD.

For example, now the store looks like:



var dirStore = new Ext.data.DirectStore({
...
api: {
create: ...,
read: ...,
update: ...,
destroy: ...
}
Now I want to add a new method called newMethod, the store will look like:



var dirStore = new Ext.data.DirectStore({
...
api: {
create: ...,
read: ...,
update: ...,
destroy: ...,
newMethod: ...
}
How can I make newMethod work?? Thanks for any help!! I've been driven crazy!!

Condor
21 Feb 2011, 6:45 AM
You have to register the new method:

Ext.data.Api.actions.newMethod = 'newMethod';