2

我有一个奇怪的问题。

在我的代码中,我有以下几行:

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);
}

选择无效!

现在,如果我改变:

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

var theId = 4;

...选择有效

和 :

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

在萤火虫中打印 4

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

在萤火虫中打印 3

为什么 ?theId 的内容始终为 4,index 的内容始终为 3 !!!

任何想法 ?

谢谢,

让-米歇尔

4

1 回答 1

0

我忘了说我在控制器的网格上有一个 selectionchange 事件:

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

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

如果我删除它,一切正常......但我的绑定表单没有更新。所以我需要它。

让-米歇尔

于 2012-10-07T06:58:54.817 回答