This is a migrated thread and some comments may be shown as answers.
Using filterMenuInit prevents checkbox from being checked on initial load
0 Answers 15 Views
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 26 Sep 2017, 07:10 PM

Using a Kendo grid with AJAX.

 

The default filter of the initial grid load is defined as:

 

    var ds = $("#history-grid").data("kendoGrid").dataSource;
        if ($("#history-search").val().trim().length == 0) {
            if (!user) { user = $("#username").text().trim(); }
            ds.filter({
                field: "RequestOwner"
                , operator: "equals"
                , value: user
            })
           }

 

The above worked great, grid would be filtered according to RequestOwner, and the checkbox for the specific user in the RequestOwner column's filter dropdown would be marked as checked when the grid was first loaded.

 

Then I added filterMenuInit to the grid initialization, which did sort the filter items appropriately, but removed the check from the checkbox for the specific user  in the RequestOwner column's filter dropdown (On initial grid load).  The filter itself is correctly applied to the grid, I just cannot get the checkbox for that value to show as checked (On initial grid load).

 

How I am defining filterMenuInit :

 

, filterable: true

, , filterMenuInit: function (e) {
            if (e.field === "RequestOwner") {
                var filterMultiCheck = this.thead.find("[data-field=" + e.field + "]").data("kendoFilterMultiCheck")
                filterMultiCheck.container.empty();
                filterMultiCheck.checkSource.sort({ field: e.field, dir: "asc" });
                filterMultiCheck.checkSource.data(filterMultiCheck.checkSource.view().toJSON());
                filterMultiCheck.createCheckBoxes();
            }
        }

 

Please advise.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
James
Top achievements
Rank 1
Share this question
or