小编San*_*erS的帖子

使用ajax代理处理Sencha touch Store中的404异常

我正在尝试通过处理可能发生的各种异常来使我的代码更加健壮.一个可能是Json Web请求的404异常.看起来当Json请求获得404异常时,不会调用store.load的回调方法.

代码:

    Ext.regModel('Activiteit', {
    fields: [
        { name: 'id', type: 'int' },
        { name: 'ServerId', type: 'int', mapping: 'Id' },
        { name: 'Title', type: 'string' },
        { name: 'Description', type: 'string' },
    ],
});

Ext.regApplication({
    name: 'App',
    launch: function () {
        console.log('launch');

        var ajaxActiviteitStore = new Ext.data.Store({
            model: "Activiteit",
            storeId: 'ajaxActiviteitStore',
            proxy: {
                type: 'ajax',
                url: '/senchatest/Activiteit/Gett/',
                reader: {
                    type: 'json',
                    root: 'activiteiten'
                }
            }
        });

        ajaxActiviteitStore.load(function (records, operation, success) {
            //the operation object contains all of the details …
Run Code Online (Sandbox Code Playgroud)

exception-handling extjs sencha-touch

8
推荐指数
2
解决办法
8502
查看次数

标签 统计

exception-handling ×1

extjs ×1

sencha-touch ×1