Cannot select the first row after grid reload
Hi Alex, I have trouble of selecting by mouse the first row in the grid after it's being reloaded. All other rows are selected fine. Only after selecting other rows I'm able to select the frist one. The problem is when my search returns only one row of data.
Bellow is the code used to build and reload my grid:
// create ActiveWidgets Grid javascript object
obj = new AW.UI.Grid;
obj.setId("MyGrid");
// provide cells and headers text
obj.setCellText(arrData);
obj.setHeaderText(arrColumns);
// set number of rows/columns
obj.setRowCount(0);
obj.setColumnCount(arrColumns.length);
// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set row selection
obj.setSelectionMode("single-row");
obj.setColumnResizable(true);
// set headers width/height
obj.setHeaderHeight(20);
// Get Selected Row index
var value = obj.getCurrentRow();
obj.setCurrentRow(value);
obj.onCurrentRowChanged = function(value){getRow(value)};
// cancel sorting event
obj.onHeaderClicked = function(){return true;}
// write grid html to the page
document.write(obj);
// Reload grid with new data
function loadGrid(arrData)
{
obj.clearRowModel();
obj.setRowCount(arrData.length);
obj.refresh();
obj.setCellData(arrData);
}
Please, help!
Bellow is the code used to build and reload my grid:
// create ActiveWidgets Grid javascript object
obj = new AW.UI.Grid;
obj.setId("MyGrid");
// provide cells and headers text
obj.setCellText(arrData);
obj.setHeaderText(arrColumns);
// set number of rows/columns
obj.setRowCount(0);
obj.setColumnCount(arrColumns.length);
// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set row selection
obj.setSelectionMode("single-row");
obj.setColumnResizable(true);
// set headers width/height
obj.setHeaderHeight(20);
// Get Selected Row index
var value = obj.getCurrentRow();
obj.setCurrentRow(value);
obj.onCurrentRowChanged = function(value){getRow(value)};
// cancel sorting event
obj.onHeaderClicked = function(){return true;}
// write grid html to the page
document.write(obj);
// Reload grid with new data
function loadGrid(arrData)
{
obj.clearRowModel();
obj.setRowCount(arrData.length);
obj.refresh();
obj.setCellData(arrData);
}
Please, help!
Boris
August 15,