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

How can I give all rows a specific value

1 Answer 770 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 03 Jul 2018, 06:17 AM

I am new to Kendo, I have a dropdownList and on Change I would like to set all of the rows in the dropDownList to "Sold" . Right now I do have the change portion of the DropDownList working but can not seem to change the value of any rows . This is my code and I am trying to follow this  example here anyways this is my code below . I have about 12 rows and my field name is Names . I am also getting an error when I try to complete that below and it says Uncaught TypeError: Cannot read property 'set' of undefined . Any suggestions on getting this resolved would be great . Again all I am trying to do is set all the rows below dropdownList with the field Names to John when someone changes value in the dropdown .

 

 <div id="MyGrid" style="text-align: center;"> </div>
function statusUpdate(element)
 {    
element.element.kendoDropDownList({       
 optionLabel: "-Select-",  dataTextField: "text",  dataValueField: "value",       
 dataSource: [{ text: "Scott", value: "Scott" },{ text: "Sam", value: "Sam" }],        
change: function (e) { 
     
    var grid = $("#MyGrid").data("kendoGrid");
        var dataItem = grid.dataSource.get(2);
        dataItem.set("Names", "John");
 
    }
   })
}

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 05 Jul 2018, 05:36 AM
Hi Mark,

The following Dojo sample shows how to use datasource data() method to iterate over all records inside DropDownList's change event. Thus, when the value of the DropDownList is changed, the "name" field for all Grid rows will be changed to "John".

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
Mark
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or