check box filter in grid : show check boxes default checked

2 posts, 0 answers
  1. Narendra
    Narendra avatar
    4 posts
    Member since:
    Mar 2015

    Posted 16 Dec 2016 Link to this post

    Hi Team,

    We are trying to use Kendo UI Grid with angular directive in our angular project.

    We are able to load the grid and also have filter menu checkboxes enabled. we want mark the check boxes checked on load. we tried to do that in the below example. it doesn't work. can you please give us some clues to make way forward in this.  

    http://dojo.telerik.com/AHIvu

     

    Thanks,

    Narendra

  2. Daniel
    Admin
    Daniel avatar
    2219 posts

    Posted 20 Dec 2016 Link to this post

    Hi,

    The checked state is applied based on the dataSource filter so if all checkboxes should be checked then you should apply a filter for all values:
    dataSource: {
      data: [ { country: "BG",checkedCountry:"checked" }, { country: "USA",checkedCountry:"checked" } ],
      filter: {
        logic: "or",
        filters: [{
          field: "country",
          operator: "eq",
          value: "BG"
        }, {
          field: "country",
          operator: "eq",
          value: "USA"
        }]
      }
    }

    Another possible solution is to use the filterMenuInit event to set the state of the checkboxes:
    filterMenuInit: function(e) {
        if (e.field === "country") {
          e.container.find(":checkbox").prop("checked", true);
        }
    }
    but note that on any dataSouce change the checkboxes will be updated and the checked state will be lost.

    Regards,
    Daniel
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top