Refresh a single Kendo grid row

后端 未结 4 1391
一生所求
一生所求 2020-12-23 16:45

Is there a way to refresh a single Kendo grid row without refreshing the whole datasource or using jQuery to set the value for each cell?

4条回答
  •  青春惊慌失措
    2020-12-23 17:21

    I found a way to update the grid dataSource and show in the grid without refreshing all the grid. For example you have a selected row and you want to change column "name" value.

    //the grid
    var grid = $('#myGrid').data('kendoGrid');    
    // Access the row that is selected
    var row = grid.select();
    //gets the dataItem
    var dataItem = grid.dataItem(row);
    //sets the dataItem   
    dataItem.name = 'Joe';
    //generate a new row html
    var rowHtml = grid.rowTemplate(dataItem);
    //replace your old row html with the updated one
    row.replaceWith(rowHtml);
    

提交回复
热议问题