Set other row cell values based on selected DropDownList Item in the grid

3 posts, 1 answers
  1. Vadim
    Vadim avatar
    16 posts
    Member since:
    Jul 2013

    Posted 31 Oct 2017 Link to this post

    I know this question has been asked many times but I was unable to find an answer, please help.
    1. I need to update a value of the column "ProductName" that is not editable. I need to do it when I change (select) value in the dropdown Category

    2. Keep the grid row in edit mode because I will change other fields in the row

    3.  And then click Update button to update the grid row. Or cancel - to restore the original values in the row


    Thank you!


    <!DOCTYPE html>
        <meta charset="utf-8"/>
        <title>Kendo UI Snippet</title>

        <link rel="stylesheet" href="">
        <link rel="stylesheet" href="">
        <link rel="stylesheet" href=""/>
        <link rel="stylesheet" href="">

        <script src=""></script>
        <script src=""></script>
    <link rel="stylesheet" href="">
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <div id="example">
      <div id="grid"></div>

            var dataSource = new{
                pageSize: 20,
                data: products,
                autoSync: false,
                schema: {
                    model: {
                        id: "ProductID",
                        fields: {
                            ProductID: { editable: false, nullable: true },
                            ProductName: { validation: { required: true }, editable: false },
                            Category: { defaultValue: { CategoryID: 1, CategoryName: "Beverages"} },
                            UnitPrice: { type: "number", validation: { required: true, min: 1} }

                dataSource: dataSource,
                pageable: true,
                height: 430,
                toolbar: ["create"],
                columns: [
                { field:"ProductName",title:"Product Name" },
                { field: "Category", title: "Category", width: "160px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },
                { field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "120px" },
                { command: ["edit", "destroy"], title: "&nbsp;", width: "250px" }],
                editable: "inline"

            function categoryDropDownEditor(container, options) {
                $('<input required data-text-field="CategoryName" data-value-field="CategoryID" data-bind="value:' + options.field + '"/>')
                    autoBind: false,
                    dataSource: {
                        type: "odata",
                        transport: {
                            read: ""
                    select: function() {
                        var grid = $("#grid").data("kendoGrid"),
                            model = grid.dataItem(this.element.closest("tr"));

                        model.ProductName = "changed";

  2. Answer
    Stefan avatar
    2737 posts

    Posted 02 Nov 2017 Link to this post

    Hello, Vadim,

    Thank you for the example.

    Please have in mind that setting editable false to the mode will not allow any changes to the model value.

    In this scenario, I can suggest setting editable false to the Grid column. Still, note that this will change the value only after the update button is clicked and the row is re-rendered:

    I made an example demonstrating this:

    I hope this is helpful.

    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.
  3. Vadim
    Vadim avatar
    16 posts
    Member since:
    Jul 2013

    Posted 09 Nov 2017 in reply to Stefan Link to this post

    thank you for reply.

    I have found a perfect solution which is working to me.
    Review: In edit mode I don't want to have a field CostCentreTitle to be editable and on dropdown CostCentre change event to be able to update a non editable value CostCentreTitle 

    1. Made a field CostCentreTitle editable
    2.On the grid edit Edit event  find CostCentreTitle and make it disabled plus change a background of the text box applying my "not-editable" class . I need it because I highlight a selected row. 
    .not-editable {
            background-color: transparent;
            border: 0px;

    Grid edit event:

     edit: function (e) {
                        //highlight edit row
                        var model = e.model,
                        container = e.container;

                        var CostCentreTitle = $('input[name *= "CostCentreTitle"]');
                        CostCentreTitle.attr('class', 'not-editable');
                        CostCentreTitle.attr("disabled", true);


    and the change event of the dropdownCostCentre will update a value of my model

    field: "CostCentre", title: "Cost Centre", width: "120px", filterable: true, template: "#= CostCentre #",
                            editor: function costCentreDropDownEditor(container, options) {
                                $('<input required id="CostCentre" name="' + options.field + '"/>')
                                        placeholder: "Select...",
                                        dataTextField: "CostCentre",
                                        dataValueField: "CostCentre",
                                        change: function (e) {
                                            // prevent adding castom values
                                            var widget = e.sender;
                                            if (widget.value() && === -1) {
                                            var costCentre = this.value();
                                            if (costCentre != "") {
                                                data =;
                                                var selectedItem = $.grep(data, function (e) { return e.CostCentre === costCentre });

                                                var grid ="kendoGrid"),
                                                model = grid.dataItem(this.element.closest("tr"));

      model.set("CostCentreTitle", selectedItem[0].CostCentreTitle);


Back to Top