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
Extjs4.1-在树面板中选择失败_Extjs_Extjs4.1 - Fatal编程技术网

Extjs4.1-在树面板中选择失败

Extjs4.1-在树面板中选择失败,extjs,extjs4.1,Extjs,Extjs4.1,我有一个树面板,当我选择like时,我会尝试获取节点 但如果你按照下面的步骤去做,你会看到bug 步骤1:运行代码并单击“获取所选节点”u将获得正确的警报,如果no selected 步骤2:双击作业节点,然后单击获取所选节点u将看到 但我看到那个节点没有被选中?如何修复感谢实际上,“家庭作业”节点是并且应该选择。双击它没有理由取消选择它 错误在于,该节点被选中的事实没有正确地可视化表示。显然是一只虫子 Sencha已在Ext4.2中对其进行了修复。看见我刚刚将版本更改为4.2.0,没有什么令

我有一个树面板,当我选择like时,我会尝试获取节点

但如果你按照下面的步骤去做,你会看到bug

步骤1:运行代码并单击“获取所选节点”u将获得正确的警报,如果
no selected

步骤2:双击
作业
节点,然后单击
获取所选节点
u将看到


但我看到那个节点没有被选中?如何修复感谢

实际上,“家庭作业”节点并且应该选择。双击它没有理由取消选择它

错误在于,该节点被选中的事实没有正确地可视化表示。显然是一只虫子

Sencha已在Ext4.2中对其进行了修复。看见我刚刚将版本更改为4.2.0,没有什么令人惊讶的事情发生

所以,为了回答你的问题,我想说为了修复它,你只需要升级到最新版本。我建议不要使用最后一个4.2.1版本,它引入了几个新的bug,而是针对4.2.0.x版本

现在,这里有一些代码,因为我被迫发布一些,以便允许链接到小提琴:

// Same code as you
Ext.onReady(function () {
    var store = Ext.create('Ext.data.TreeStore', {
        fields: [
                {name: 'id',     type: 'string'},
                {name: 'text',     type: 'string'},
                {name: 'selected', type: 'string'}
        ],
        root: {
            expanded: true,
            id: '0',
            children: [{
                text: "detention",
                id: '1',
                leaf: true
            }, {
                text: "homework",
                id: '2',
                expanded: true,
                children: [{
                    id: '3',
                    text: "book report",
                    leaf: true
                }, {
                    id: '4',
                    text: "alegrbra",
                    leaf: true,
                    selected: 'true'
                }]
            }, {
                id: '5',
                text: "buy lottery tickets",
                leaf: true
            }]
        }
    });

    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 200,
        store: store,
        rootVisible: false,
        dockedItems: [{
            xtype: 'toolbar',
            items: {
                text: 'Get Selected nodes',
                handler: function(){
                    var s = this.up('panel').getSelectionModel().getSelection();
                    if (s[0])
                        alert(s[0].data.text + ' was selected');
                    else alert('no selected');
                }
            }
        }],
        renderTo: Ext.getBody()
    });
});

+1对于良好完整运行的独立代码和准确描述所需的步骤进行复制。
// Same code as you
Ext.onReady(function () {
    var store = Ext.create('Ext.data.TreeStore', {
        fields: [
                {name: 'id',     type: 'string'},
                {name: 'text',     type: 'string'},
                {name: 'selected', type: 'string'}
        ],
        root: {
            expanded: true,
            id: '0',
            children: [{
                text: "detention",
                id: '1',
                leaf: true
            }, {
                text: "homework",
                id: '2',
                expanded: true,
                children: [{
                    id: '3',
                    text: "book report",
                    leaf: true
                }, {
                    id: '4',
                    text: "alegrbra",
                    leaf: true,
                    selected: 'true'
                }]
            }, {
                id: '5',
                text: "buy lottery tickets",
                leaf: true
            }]
        }
    });

    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 200,
        store: store,
        rootVisible: false,
        dockedItems: [{
            xtype: 'toolbar',
            items: {
                text: 'Get Selected nodes',
                handler: function(){
                    var s = this.up('panel').getSelectionModel().getSelection();
                    if (s[0])
                        alert(s[0].data.text + ' was selected');
                    else alert('no selected');
                }
            }
        }],
        renderTo: Ext.getBody()
    });
});