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

AngularJs Kendo-grid kendo-drop-down-list inside headerTemplate iterate data from template

1 Answer 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cezary
Top achievements
Rank 1
Cezary asked on 08 Apr 2021, 10:13 AM

kendo-ui: ver. 2018.2.516

I want to select value in  headerTemplate then iterate throught all data in templates and if select in template contains same value change it. I can’t find any information how to do it

Could someone help me?

columns: [{
    title: "task",
    headerTemplate:
'<select kendo-drop-down-list k-options="$ctrl.multiSelect(dataItem)"></select>',
    field: "task_id",
template:
 '<select kendo-drop-down-list k-options="$ctrl.templateSelect(dataItem)"></select>',
    width: "240px"
}

 

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 12 Apr 2021, 06:01 AM

Hi Cezary,

When the grid has a DropDownList widget inside the header template, you should attach the change event to it. Within the handler, you should loop through the rows of the grid.

https://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist/events/change

And within the handler, loop through the items and make a selection for the DropDownList widgets accordingly:

var gridRows = $("#grid").getKendoGrid().tbody.find("tr");
   gridRows.each(function(e){
      var ddl = $(this).find("[data-role='dropdownlist']").getKendoDropDownList();
      //custom logic
      ddl.value(myNewValue);
   });

 

Regards,
Tsvetomir
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
Grid
Asked by
Cezary
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or