Hello,
I was looking for a way to allow my users to customize their interface, and to choose the columns order of some grids.
I choose a client side reordering as I don't want the data to be reloaded (too long) and the ongoing modification lost (GridEditMode.Batch).
In order to save the preference of the user, I susbcribed to the "onColumnSwapped" event. Then my javascript function calls "ajaxManager.ajaxRequest" (which save the new columns order into my database)
First issue: in my "RadAjaxManager1_AjaxRequest" (server side), if I look the OrderIndex of the columns of my grid, they have their original values. Is this normal ?
I could decide to save the profil with a custom button "Save Column Order" (I tried and the OrderIndex are the correct / changed ones) but I want to avoid adding another button to my interface.
As I already have the column order stored server side, I decided to simply send the two argument from the javascript to my server function:
var
sourceIndex = eventArgs.get_gridSourceColumn().get_element().cellIndex;
var
destinationIndex = eventArgs.get_gridTargetColumn().get_element().cellIndex;
Then I make the change myself server side and save it to the database.
It works well with GridClientSettings.GridColumnsReorderMethod.Swap.
However it doesn't work with GridClientSettings.GridColumnsReorderMethod.Reorder. The javascript event is called multiple times (swapping multiple time) but the ajax request is called only 1 time ! (the last time).
Example: If I move the 4th columns to position 1.
The javascript event is called 3 times with the following parameters (source, destination):
4,3
3,2
2,1
And my AjaxRequest is called only 1 time with the following parameters (source, destination):
2,1
Any suggestions ?
Thank you