Grid Context

I have two jsp pages, one for the search and another one for the data. So I’ve a dhtmlxGrid in the first one.

I select a row and navigate to the data page to show all of data of the row.



Then I push the “back” button and I want the grid loaded, ordered by the same column, in the same pagination page and with the same selected row.



I need to now the selected row, the page selected and the sorted column, to save them in the session. And, when return to the search page, reload again the grid, ordered by the column, the page and the row selected . Is it possible?



I’ve been searching for this and I got this:



var state = mygrid.getStateOfView();

var pageselected = state[0];

var rowselected = mygrid.getSelectedRowId();



With this I can select a row:

mygrid.setSelectedRow(id);



�but the page and the order column?



Thanks.


When you select row “onRowSelect” event fired. This event contain information about selected rowId and selected column index.


mygrid.attachEvent(“onRowSelect”, function(rowId,cellIndex){


//your code here


});


The current page is the “currentPage” grid property:


var cPage = grid.currentPage;


changePage(pageNum) method can be used to change current page:


grid.loadXML(url,function(){
grid.changePage(2);
});
grid.currentPage; and grid.changePage() method availible at PRO version only.


and the order column?

You can save column order to cookies with method mygrid.saveOrderToCookie();. To load column order from cookies use mygrid.loadOrderFromCookie();. You can see example here dhtmlx.com/docs/products/dhtmlxG … _save.html