PDA

View Full Version : Issue with focus on selected row in GridView.js



gcsolaroli
15 Jan 2007, 9:24 AM
I have found a problem on the GridView; the issue arise when you update the value of the selected row, and the updated value is used also for sorting.

Example:
I have a long list of records, sorted for the name of the record. The grid has a vertical scrollbar, as the list is longer than the available space.
I select the first record, named "Amazon", and edit it to became "Zimbra".
The grid keeps the selection on the (now "Zimbra") current record, but it will not scroll to the bottom of the list in order to keep the selected record visible.

With the following path I have been able to let the gridView scroll to the correct point.

$ diff src/js/YUI-extensions/grid/GridView.js ../../../../other_projects/YUI-extensions/trunk/src/grid/GridView.js
366d365
< var selectedRows;
372,375c371,373
< selectedRows = this.grid.selModel.getSelectedRows();
< if (selectedRows.length > 0) {
< this.focusRow(selectedRows[0]);
< }
---
> if(this.lastFocusedRow){
> this.focusRow(this.lastFocusedRow);
> }