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

Grid doesn't update filter icon after filtering datasource

2 Answers 478 Views
Grid
This is a migrated thread and some comments may be shown as answers.
OmarOrnelas
Top achievements
Rank 1
OmarOrnelas asked on 04 Apr 2013, 03:39 PM
I'm having a problem with the kendo grid. We are storing sorting and filtering in a DB and then restoring it when the user comes back to the page. Both sorting and filtering work correctly on the grid, however, the filtering icon doesn't change for the filtered column(s). The sorting indicator does work properly, it displays the arrow on the column, but the filtering doesn't display.

One thing I noticed while putting together a test for you guys to look at is that if you click the column filter once and close it, after that it starts working, but if you only apply the filter to the datasource initially and don't click the icon, it doesn't change.

You can look at my example (taken from your default examples) here.
http://jsbin.com/equbeg/1/

Thanks,
Omar

2 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 05 Apr 2013, 01:59 PM
Hello Omar,


Thank you for bringing this issue at our attention. This is happening, because since Q1 2013 the filter and column menus are using lazy evaluation i.e. they are not initialized on the first data bound, but the first time they are opened. I have escalated the issue to our development team and it is logged for fixing. At the moment you could either trigger the filter menu initialization or add the class manually if needed.
E.g.
var grid = $("#Grid").data("kendoGrid");
grid.dataSource.filter({ field: "ProductName", operator: "contains", value: "test" });
var thFilter = grid.thead.find("th[data-field='ProductName'] .k-grid-filter");
if (!thFilter.hasClass("k-state-active")) {
    thFilter.addClass("k-state-active");
}

As a small sign of gratitude I am also updating your Telerik points.

 

Greetings,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
OmarOrnelas
Top achievements
Rank 1
answered on 08 Apr 2013, 03:43 PM
Thanks for looking into this Dimiter (and for the points).

I'll definitely apply this fix for now.
Tags
Grid
Asked by
OmarOrnelas
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
OmarOrnelas
Top achievements
Rank 1
Share this question
or