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

check box filter in grid : show check boxes default checked

1 Answer 648 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Narendra
Top achievements
Rank 1
Narendra asked on 16 Dec 2016, 10:50 AM

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

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 20 Dec 2016, 08:17 AM
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.
Tags
Grid
Asked by
Narendra
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or