Jquery – Kendo Grid – How to add columns dynamically?

jquerykendo-gridkendo-ui

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.

Best Solution

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