您的位置:首页 > Web前端 > JavaScript

Extjs4 使用store的post方法

2013-05-27 10:51 106 查看
Extjs4 使用store的post方法需要修改actionmathods

You have to override actionMethod property

Ext.define('Sencha.store.Teams', {
extend: 'Ext.data.Store',

config: {
model: 'Sencha.model.Team',
autoLoad: true,
proxy: {
type: 'ajax',
actionMethods: {
create : 'POST',
read   : 'POST', // by default GET
update : 'POST',
destroy: 'POST'
},
url: 'teams.json'
}
}
});

or define your own proxy class

Ext.define('Sencha.data.PostAjax', {
extend: 'Ext.data.proxy.Ajax',
alias: 'proxy.postproxy', // must to get string reference
config: {
actionMethods: {
create : 'POST',
read   : 'POST', // by default GET
update : 'POST',
destroy: 'POST'
},
}
}

Ext.define('Sencha.store.Teams', {
extend: 'Ext.data.Store',

config: {
model: 'Sencha.model.Team',
autoLoad: true,
proxy: {
type: 'ajaxpost'
url: 'teams.json'
}
}
});

Disclaimer: code was written from scratch and not really tested. Please do not downvote if it does not work, before not get replay on your comment. Thanks.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: