How can I give all rows a specific value

2 posts, 0 answers
  1. Mark
    Mark avatar
    1 posts
    Member since:
    Jul 2018

    Posted 03 Jul Link to this post

    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");
     
        }
       })
    }
  2. Dimitar
    Admin
    Dimitar avatar
    396 posts

    Posted 05 Jul Link to this post

    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.
Back to Top