Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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 使用存储加载JSON时出现问题_Sencha Touch_Extjs_Sencha Touch 2 - Fatal编程技术网

Sencha touch 使用存储加载JSON时出现问题

Sencha touch 使用存储加载JSON时出现问题,sencha-touch,extjs,sencha-touch-2,Sencha Touch,Extjs,Sencha Touch 2,我正试图从服务器获取一些JSON格式的主数据,并在Store的帮助下将其绑定到selectfield 在下面找到我的代码 型号 Ext.define('Mobile.model.OrganizationModel', { extend: 'Ext.data.Model', config: { fields: [ { name: 'Name', type: 'string' }, { name: 'Id', type: 'int' } ]

我正试图从服务器获取一些JSON格式的主数据,并在Store的帮助下将其绑定到selectfield

在下面找到我的代码

型号

Ext.define('Mobile.model.OrganizationModel', {
  extend: 'Ext.data.Model',
   config: {
    fields: [
        { name: 'Name', type: 'string' },
        { name: 'Id', type: 'int' }
    ]
   }
});
商店

Ext.define('Mobile.store.OrganizationStore', {
extend: 'Ext.data.Store',
model: 'Mobile.model.OrganizationModel',

autoLoad: true,

proxy: {
    type: 'ajax',
    url: 'login/GetOrgList',
    method: 'GET',
    reader: {
        type: 'json'
    }
}

});
查看

Ext.define("Mobile.view.LoginView", {
extend: "Ext.form.FormPanel",
alias: "widget.login",
id: 'loginFormPanel',

config: {

    margin: '0 auto',
    name: 'loginform',
    frame: true,
    url: 'login/Authenticate',
    title: 'something',
    items: [

      {
          xtype: 'fieldset',

          itemId: 'LoginFieldset',
          margin: '10 auto 0 auto ',

          title: '',
          items: [
                  {
                      xtype: 'selectfield',
                      label: 'Organization',
                      name: 'Organization',
                      store: 'OrganizationStore',
                      displayField: 'Name',
                      valueField: 'Id',
                      placeHolder: 'Select a Value'
                  }
            ]
      },


    ]
 }

});
APP.js

Ext.application({
name: "Mobile",   
controllers: ["LoginController"],
views: ['LoginView', 'HomeView'],
models: ['UserModel', 'OrganizationModel'],
stores: ['OrganizationStore'],
launch: function () {
    var loginPanel = Ext.create('Ext.Panel', {
        layout: 'fit',
        items: [
            {
                xtype: 'login'
            }
        ]
    });
    Ext.Viewport.add(loginPanel);
}

});
JSON数据格式是

[{“Id”:1,“名称”:“公司1”},{“Id”:2,“名称”:“公司2”},{“Id”:3,“名称”:“公司3”}]


问题在于它没有向服务器发送请求并加载JSON数据和绑定。你知道这个问题吗

将存储代码更新到

    Ext.define('Mobile.store.OrganizationStore', {
extend: 'Ext.data.Store',
config:{
model: 'Mobile.model.OrganizationModel',

autoLoad: true,

proxy: {
    type: 'ajax',
    url: 'login/GetOrgList',
    method: 'GET',
    reader: {
        type: 'json'
    }
}


  }
  });

将存储代码更新到

    Ext.define('Mobile.store.OrganizationStore', {
extend: 'Ext.data.Store',
config:{
model: 'Mobile.model.OrganizationModel',

autoLoad: true,

proxy: {
    type: 'ajax',
    url: 'login/GetOrgList',
    method: 'GET',
    reader: {
        type: 'json'
    }
}


  }
  });

谢谢这对我有用。但有必要保留配置部分吗?但这份文件从未提及此事。你能给我一些链接,我可以参考从服务器加载并在本地编辑,然后在商店的帮助下更新回服务器。我正在搜索,但不幸的是:(不要使用ExtJS的文档来搜索Sencha Touch:)谢谢。这对我有用。但有必要保留配置部分吗?但这份文件从未提及此事。你能给我一些链接,我可以参考从服务器加载并在本地编辑,然后在商店的帮助下更新回服务器。我正在搜索,但很不幸:(不要使用ExtJS中的文档来搜索Sencha Touch:)