Using filterMenuInit prevents checkbox from being checked on initial load

1 posts, 0 answers
  1. James
    James avatar
    1 posts
    Member since:
    Sep 2017

    Posted 26 Sep 2017 Link to this post

    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.

Back to Top