Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sencha touch 使用POST代理加载存储?_Sencha Touch_Sencha Touch 2 - Fatal编程技术网

Sencha touch 使用POST代理加载存储?

Sencha touch 使用POST代理加载存储?,sencha-touch,sencha-touch-2,Sencha Touch,Sencha Touch 2,我有一个需要用POST而不是GET调用的服务。 我想我在某个地方读到,我可以简单地添加方法: 代理上的“POST”选项,但似乎没有效果 Ext.define('Sencha.store.Teams', { extend: 'Ext.data.Store', config: { model: 'Sencha.model.Team', autoLoad: true, proxy: {

我有一个需要用POST而不是GET调用的服务。 我想我在某个地方读到,我可以简单地添加方法: 代理上的“POST”选项,但似乎没有效果

Ext.define('Sencha.store.Teams', { extend: 'Ext.data.Store', config: { model: 'Sencha.model.Team', autoLoad: true, proxy: { type: 'ajax', // method: 'GET', method: 'POST', url: 'teams.json' } } }); Ext.define('Sencha.store.Teams'{ 扩展:“Ext.data.Store”, 配置:{ 模型:“Sencha.model.Team”, 自动加载:对, 代理:{ 键入:“ajax”, //方法:“GET”, 方法:“POST”, url:'teams.json' } } });
您必须重写actionMethod属性

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'
        }
    }
});
或者定义自己的代理类

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'
        }
    }
});

免责声明:代码是从头开始编写的,没有经过真正的测试。请不要否决,如果它不工作,在没有得到你的评论重播。谢谢。

您必须重写actionMethod属性

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'
        }
    }
});
或者定义自己的代理类

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'
        }
    }
});
免责声明:代码是从头开始编写的,没有经过真正的测试。请不要否决,如果它不工作,在没有得到你的评论重播。谢谢