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

Enable/Disable Filtering

3 Answers 1441 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khushali
Top achievements
Rank 1
Khushali asked on 09 Apr 2012, 06:52 AM
Hi,

I have a kendo grid in which i have filtering enabled. I have a check box,and when i uncheck it,i want the filtering to be disabled. And similarly,when i check it i want to enable it. How can i achieve it?

Regards,
Khushali

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 11 Apr 2012, 09:16 AM
Hi Khushali,

Disabling the filter functionality at runtime is not currently supported. As a workaround you could prevent the click on the filter icons by covering them with transparent <div> elements.

In this jsFiddle you can see the aforementioned approach in action.

Greetings,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Oleksandr
Top achievements
Rank 1
answered on 12 Aug 2015, 01:21 PM

Hi Alexander,

Unfortunately the provided solution works only in case grid is static, columns cannot be resized, or moved. It is possible to break the example simply by resizing jsFiddle previewPane after checking the checkbox.

Maybe there is some better solution now (your answer is quite old already)?

 Thanks,

0
Dimo
Telerik team
answered on 17 Aug 2015, 08:38 AM
Hello Oleksandr,

There are two alternative ways to achieve the desired behavior:

1) use setOptions() to re-create the Grid with the appropriate filterable settings.

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions
 
http://demos.telerik.com/kendo-ui/grid/persist-state


2) use a custom CSS class applied to the Grid wrapper <div> to hide the filter icons when needed

http://docs.telerik.com/kendo-ui/framework/widgets/wrapper-element

.my-custom-grid-class .k-grid-filter
{
   display: none;
}


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Khushali
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Oleksandr
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or