Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Harish on Mar 11, 2008 06:21
open dhtmlx forum
Sorting issue after refresh


Hi,

After sorting the DhtmlxGrid by clicking on one of the headers, and clicks on one of the button in the grid, where i am doing a database update, the page refreshes back to unsorted.

The button click is like this

function gridButtonClicked(target,argument )
{
__doPostBack(''+target,''+argument);
}

this is how i am setting the button

WriteSearchResultsCell(writer, "<img src=\"../images/icn_lock.gif\" style=\"cursor:hand; border:0px;\" alt=\"" + objCheckoutUser.FirstName + " " + objCheckoutUser.LastName + " Checked out at " + objRequest.CheckoutTime.ToString() + "\" onclick = \"gridButtonClicked('Lock#Edit' ,'" + objRequest.RequestID + "')\" />", true);

I want the DhtmlxGrid should remain sorted after the page refreshes .Please help me.

Thank you in advance.

Harish
Answer posted by Support on Mar 12, 2008 09:50
There are two ways

a) you need to attach onAfterSort event and monitor sorting state of grid, this state need to be included in server side call - in such case server side code will be able to return data in necessary order

or

b) you can save|restore sorting state in|from cookie
        grid.enableSortingSaving()
        grid.loadSortingFromCookie();
        http://dhtmlx.com/docs/products/dhtmlxGrid/samples/rows_columns_manipulations/pro_column_states_save.html?un=1205241999000