Extjs4 使用store的post方法

来源:互联网 发布:网络电视频道大全图标 编辑:程序博客网 时间:2024/05/16 02:47

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.


原创粉丝点击