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
Json ExtJs数据存储值为空,但存储原始值已填充_Json_Extjs - Fatal编程技术网

Json ExtJs数据存储值为空,但存储原始值已填充

Json ExtJs数据存储值为空,但存储原始值已填充,json,extjs,Json,Extjs,因此,我很难确定为什么没有为itemselector组件填充存储区的数据值,但是填充了原始数据值,看起来我的模型和存储区设置正确。我正试图利用json数据的第一个特定部分,因此我将rootProperty设置为“data[0].options”。只是尝试用json数据的“区域”集合填充itemselector。组件如下,如有任何帮助,将不胜感激 项目选择器 xtype: 'itemselector', cls: 'itemSelectorPlain

因此,我很难确定为什么没有为itemselector组件填充存储区的数据值,但是填充了原始数据值,看起来我的模型和存储区设置正确。我正试图利用json数据的第一个特定部分,因此我将rootProperty设置为“data[0].options”。只是尝试用json数据的“区域”集合填充itemselector。组件如下,如有任何帮助,将不胜感激

项目选择器

xtype: 'itemselector',
                        cls: 'itemSelectorPlainPanel',
                        margin: '10 10 10 10',
                        labelAlign: 'top',
                        height: 200,
                        flex: 1,
                        autoScroll: true,
                        id: 'ertcSelector',
                        buttons: ['add', 'remove'],
                        reference: 'ertcSelector',
                        store: Ext.create('cers.store.ManagerFilterStore'),
                        displayField: 'label',
                        allowBlank: true,
                        msgTarget: 'side',
                        fromTitle: 'Available ERTC Home Area',
                        toTitle: 'Selected ERTC Home Area',
                        listeners: {
                         render: function() {
                             console.log(this);
                             /*console.log('Value is ' + this.fromField.store.data.items.length);*/
                            }
                         }
贮藏

模型

Json数据

{
  "data" : [ {
    "model" : "Area",
    "functionality" : "ManagerQueueFilter",
    "options" : [ {
      "label" : "HeadQuarters",
      "value" : "12",
      "active" : true,
      "selected" : false
    }, {
      "label" : "Northeast",
      "value" : "2",
      "active" : true,
      "selected" : false
    }, {
      "label" : "Testing Area",
      "value" : "41",
      "active" : true,
      "selected" : false
    } ], }
{
    "model" : "User",
    "functionality" : "ManagerQueueFilter",
    "options" : [
{
      "label" : "Green, Ted",
      "value" : "c0gret6_vzwm",
      "active" : false,
      "selected" : false
    }, {
      "label" : "Eksioglu, Oguz",
      "value" : "eksioog",
      "active" : true,
      "selected" : true
    } ]
  } ],
  "total" : 2,
  "success" : true,
  "message" : "Success"

尝试将
模式
属性添加到
项目选择器

...
mode: 'local',
...

另外,您还没有将
valueField
设置为“字段”。

哦,我只是在等待datachanged事件的侦听器中手动将数据设置为与原始数据值相等,如下所示:

listeners: {
        datachanged: function() {
            for(i = 0; i < this.getData().items.length; i++) {
                this.getData().items[i].data = this.getData().items[i].raw;
                console.log('New Data ' + i);
                console.log(this.getData().items[i].data);
            }
        }
    }
侦听器:{
datachanged:函数(){
对于(i=0;i

这是非法的,但它起作用了,仍然不知道为什么那些模型实例没有填充。

这不起作用。我不确定“local”是什么模式,我在extjs 5.1 itemSelector文档中没有看到它。我不认为它适用于我这里顺便说一句,我的商店的代理中的url实际上是远程的,但我只是不在这里列出它。
...
mode: 'local',
...
listeners: {
        datachanged: function() {
            for(i = 0; i < this.getData().items.length; i++) {
                this.getData().items[i].data = this.getData().items[i].raw;
                console.log('New Data ' + i);
                console.log(this.getData().items[i].data);
            }
        }
    }