Hello,
I’m using the grid to implement a search screen where the user can enter several criterias, click a button and see the search results. When the user clicks the search button, I do a request using AJAX, so the page is not reloaded. To avoid problems, I was clearing the grid completely before making the request, as I saw in the post:
/javascript.forum.11480.2/refresh-content-in-grid.html
But, even with this, I still had got a problem: if I select a row (say for example row number 1) and then I do a new seach, I cannot select the row 1 again (if I select another row, then I can select row 1 again). After a lot of debug, I have seen that the selected rows are not cleared, so when you enter the function:
function selectRow(r){
if (r!=this.getCurrentRow()){
this.setCurrentRow(r);
}
var rr = this.getSelectedRows();
if (rr.length != 1 || rr[0] != r){
this.setSelectedRows([r]);
}
}
getSelectedRows() still returns [1], and the row is not selected.
I have solved it setting an empty array manually when I clear the grid, but I’m not sure about the implications of doing this…
tablaBusqueda.clearScrollModel();
tablaBusqueda.clearSelectionModel();
tablaBusqueda.setSelectedRows([]);
tablaBusqueda.clearSortModel();
tablaBusqueda.clearRowModel();
tablaBusqueda.setRowCount(0);
tablaBusqueda.refresh();
table_tablaBusqueda.request();
BTW. I’m using single row select mode.
Best regards,
José Luis.