2

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

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

print 3 in firebug

Why ? the content of theId is always 4 and the content of index is always 3 !!!

Any idea ?

Thanks,

Jean-Michel

jm130794
  • 31
  • 4

1 Answers1

0

I forgot to say that I have a selectionchange event on my grid in the controller :

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

jm130794
  • 31
  • 4
  • Can paste the full code to pastebin or a gist? It would be good to see the grid configuration, and where you are executing this code. I don't see how this function could have an effect on the select method but maybe something in the config has. – Jamie Sutherland Oct 07 '12 at 20:42