简体   繁体   English

为什么select在ExtJS(Ext.selection.Model)中不起作用

[英]Why select doesn't work in ExtJS (Ext.selection.Model)

I have a strange problem. 我有一个奇怪的问题。

In my code, I've this lines : 在我的代码中,我有以下几行:

var theId = operation.records[0].get('id');
console.log("theId: " + theId); // print 4 in firebug
var index = gridStore.find('id', theId);
console.log("index: " + index); // print 3 in firebug

if (index != -1) {
    gridPanel.getSelectionModel().select(index);
}

The selection doesn't work ! 选择无效!

Now, if I change : 现在,如果我更改:

var theId = operation.records[0].get('id');

to

var theId = 4;

... the selection works ...选择工作

and : 和:

console.log("theId: " + theId);

print 4 in firebug 在萤火虫中打印4

console.log("index: " + index);

print 3 in firebug 在萤火虫中打印3

Why ? 为什么呢 the content of theId is always 4 and the content of index is always 3 !!! theId的内容总是4,索引的内容总是3!

Any idea ? 任何想法 ?

Thanks, 谢谢,

Jean-Michel 让·米歇尔

I forgot to say that I have a selectionchange event on my grid in the controller : 我忘了说我在控制器的网格上有一个selectionchange事件:

gridSelectionChange: function(grid, records) {
    console.log('gridSelectionChange');

    if (records[0]) {
        this.getAuthorForm().getForm().loadRecord(records[0]);
    }
},

If I remove this, all works fine... but my bind formpanel is not updated. 如果删除此链接,则一切正常...但是我的绑定表单面板未更新。 So I need it. 所以我需要。

Jean-Michel 让·米歇尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM