Reputation: 38209
My kendo-grid:
<kendo-grid>
<ng-template ngFor [ngForOf]="gridColumns" let-column>
<kendo-grid-column field="{{column}}" title="{{column}}">
<ng-template kendoGridHeaderTemplate let-dataItem >
<span title={{column}}>{{column}}</span>
</ng-template>
</kendo-grid-column>
</ng-template>
</kendo-grid>
I have a JSON
response in the following format:
Books: [
{
BookName: "Hello World!",
PageCount: 455
},
{
MagazineName: "Hello World!",
PageCount: 455
}
],
FirstName: "Jon",
LastName: "Arlington",
City: "London"
and I've managed to populate columns from the JSON
like this:
let gridColumns = ["FirstName", "LastName", "BookName", "MagazineName", "PageCount",
"MagazineName", "PageCount" ];
My question is how can I add rows to columns?
Upvotes: 0
Views: 1027
Reputation: 21475
Just use dataSource's add()
method:
var book = {
MagazineName: "Hello World!",
PageCount: 455,
FirstName: "Jon",
LastName: "Arlington",
City: "London"
};
grid.dataSource.add(book);
Upvotes: 1