I am trying to select the specific row (row with today's date) of grid after its creation.
Please find the following function which I am calling after creating the grid.
Here, sgDataView is dataview and sgGrid is already loaded slick grid
function SetDefaultDateSelected() {
for (var rowIndex = 0; sgDataView.getLength(); rowIndex++) {
var gridRow = sgDataView.getItem(rowIndex);
if (gridRow.Date == $.datepicker.formatDate('dd-M-yy', new Date())) {
sgGrid.setSelectedRows(gridRow);
sgGrid.scrollRowIntoView(rowIndex);
break;
}
}
}
Could anyone please let me know why sgGrid.setSelectedRows(gridRow); is not setting the selected row?
Please let me know in case of any other approach.