tianhao
14 Nov 2012, 8:33 PM
hi all,i have the following code to focus and scroll to a certain record in a grid:
Ext.onReady(function(){
var mainPanel = Ext.create('Ext.grid.Panel', {......});
});
mainPanel.render(document.body);
var rowindex = 66;
mainPanel.getSelectionModel().select(rowindex);
mainPanel.getView().focusRow(rowindex);
this can focus the record in the grid but cannot scroll to the record.but if i create a button with the last three line code,it works when i click the button.
Ext.onReady(function(){
var mainPanel = Ext.create('Ext.grid.Panel', {......
buttons: [{text: 'FocusScroll',
handler: function() {
var rowindex = 66;
mainPanel.getSelectionModel().select(rowindex);
mainPanel.getView().focusRow(rowindex);
}
}]
});
});
mainPanel.render(document.body);
how can i focus and scroll after the grid render without the button?
thank you very much.
Ext.onReady(function(){
var mainPanel = Ext.create('Ext.grid.Panel', {......});
});
mainPanel.render(document.body);
var rowindex = 66;
mainPanel.getSelectionModel().select(rowindex);
mainPanel.getView().focusRow(rowindex);
this can focus the record in the grid but cannot scroll to the record.but if i create a button with the last three line code,it works when i click the button.
Ext.onReady(function(){
var mainPanel = Ext.create('Ext.grid.Panel', {......
buttons: [{text: 'FocusScroll',
handler: function() {
var rowindex = 66;
mainPanel.getSelectionModel().select(rowindex);
mainPanel.getView().focusRow(rowindex);
}
}]
});
});
mainPanel.render(document.body);
how can i focus and scroll after the grid render without the button?
thank you very much.