Showing posts with label datastore. Show all posts
Showing posts with label datastore. Show all posts

Sunday, May 22, 2011

force extjs.data.store to use POST(or GET) only

By default extjs.data.store will use 'POST' when you pass any parameters, otherwise, it will use 'GET'. For example:
//use 'GET'
{
xtype : 'jsonstore',
url     :  'list.php'
}

//use 'POST'
{
xtype : 'jsonstore',
url     : 'getArticle.php',
params : {user_id : 1}
}

In case we want to always use one method without worrying about parameters, we have to specify the proxy:
//always use 'POST'
{
xtype : 'jsonstore',
proxy : new Ext.data.HttpProxy({url:'list.php', method:'POST'})
}

To use 'GET' only, just change the method to 'GET'.