2

For grid view i have json array of objects which is filled dynamically.

Is possible to generate columns dynamically with posssibility to edit values on model and send them back in update request?

Thanks for any advice or example.

redrom
  • 11,502
  • 31
  • 157
  • 264

1 Answers1

3

Same question asked here.

First you need to resolve columns from json array and store them in another array. Create columns and use grid column option to set columns dynamically. Also you need Kendo DataSource for showing data. Here is a great example by @Paritosh how to accomplish what you need.

var columns = data;

var configuration = {
    editable: true,
    sortable: true,
    scrollable: false,
    columns: columns    //set the columns here
};

var grid = $("#grid").kendoGrid(configuration).data("kendoGrid");
kendo.bind($('#example'), viewModel);   //viewModel will be data as in jsfiddle
Community
  • 1
  • 1
Jarno Lahtinen
  • 1,713
  • 17
  • 30