This is a migrated thread and some comments may be shown as answers.

[Solved] Switching sorting from multiple to single and back

2 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 12 Feb 2015, 10:56 AM
Hi

In my example below I took your demo for multiple sorting (good one!) and created a button with which I can change the sorting type.

http://dojo.telerik.com/ARaMA

I am refreshing the grid after changing the sorting type, but the grid does not seem to refresh properly.

I have variables initially set to "multiple" and true (for multiple sort as per your example)
sortable: {
            mode: sortmode,
             allowUnsort: sortunsort
},
.. and I change them on button click so "single" and false and then do
$('#multipleSort').data('kendoGrid').dataSource.read();
$('#multipleSort').data('kendoGrid').refresh();

..which does not properly update.

I also tried changing
$('#multipleSort').data('kendoGrid').options.sortable.mode = "single";
$('#multipleSort').data('kendoGrid').options.sortable.allowUnsort = false;

but again I do not update correctly because it does have no effect, even though it is actually set.

Many thanks

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 15 Feb 2015, 08:36 PM
Hello,

As from Q3 2014, the Grid supports the setOptions method, which can change particular feature/option (in your case the sorting) dynamically.

I also modified your dojo sample to use the setOptions method and it works fine now.


Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Markus
Top achievements
Rank 1
answered on 16 Feb 2015, 08:33 AM
Great thanks, works perfectly
Tags
Grid
Asked by
Markus
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Markus
Top achievements
Rank 1
Share this question
or