Kendo UI for Angular2 - How to dynamically add columns to grid


Jarreg

For Grid compomemet, if I already have several columns predefined in html, but the result set can have many other columns on the predefined columns, how can I add these columns dynamically?

After I retrieve the data, I don't know what these extra columns are? After fetching the data using the ViewChild directive, I am able to access the grid components, but viewing the array of grid columns as objects, I can't see a way to programmatically add columns on the fly.

Alex Gyoshev

You can use ngFor to generate a variable number of columns:

    <kendo-grid [data]="gridData">
      <ng-template ngFor [ngForOf]="columns" let-column>
        <kendo-grid-column field="{{column}}"></kendo-grid-column>
      </ng-template>
    </kendo-grid>

If you want to try it out, see the "Showing and Hiding Columns" demo in the documentation ( scroll down for column examples ).

Related


Kendo UI for Angular2 - How to dynamically add columns to grid

Jarreg For Grid compomemet, if I already have several columns predefined in html, but the result set can have many other columns on the predefined columns, how can I add these columns dynamically? After I retrieve the data, I don't know what these extra column

Kendo UI for Angular2 - How to dynamically add columns to grid

Jarreg For Grid compomemet, if I already have several columns predefined in html, but the result set can have many other columns on the predefined columns, how can I add these columns dynamically? After I retrieve the data, I don't know what these extra column

Kendo UI for Angular2 - How to dynamically add columns to grid

Jarreg For Grid compomemet, if I already have several columns predefined in html, but the result set can have many other columns on the predefined columns, how can I add these columns dynamically? After I retrieve the data, I don't know what these extra column

Kendo UI for Angular2 - How to dynamically add columns to grid

Jarreg For Grid compomemet, if I already have several columns predefined in html, but the result set can have many other columns on the predefined columns, how can I add these columns dynamically? After I retrieve the data, I don't know what these extra column

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Kendo UI Grid for Angular to dynamically reorder columns

Exquisite I have a Kendo UI for Angular and not one for JQuery, and I've been trying to see how to reorder the columns dynamically. The API allows enabling it by reordering like this: <kendo-grid [reorderable]="true"...../> But I want tp to be able to reorder

Dynamically create kendo grid columns in angular controller

Kevin I'm trying to dynamically build the structure of a kendo corner mesh. My problem is that the grid options are not known when the k-optionsproperty is evaluated , so the grid will be bound to all columns on the data source. Here is the HTML: <div kendo-gr

Dynamically create grid for Angular in Kendo UI

ps0604 Kendo UI for Angular has a grid that can be defined as follows: <kendo-grid [data]="gridData" [height]="410"> <kendo-grid-column field="ProductID" title="ID" width="40"> </kendo-grid-column> <kendo-grid-column field="

Dynamically create grid for Angular in Kendo UI

ps0604 Kendo UI for Angular has a grid that can be defined as follows: <kendo-grid [data]="gridData" [height]="410"> <kendo-grid-column field="ProductID" title="ID" width="40"> </kendo-grid-column> <kendo-grid-column field="

Dynamically create grid for Angular in Kendo UI

ps0604 Kendo UI for Angular has a grid that can be defined as follows: <kendo-grid [data]="gridData" [height]="410"> <kendo-grid-column field="ProductID" title="ID" width="40"> </kendo-grid-column> <kendo-grid-column field="

Kendo UI for Angular custom sorting grid columns

h3li0s I have the following column in Kendo Grid (Jquery's UI) which has a special sorting method based on customer needs. field: "daysLeft", title: "Accessible", width: 130, sortable: { compare: function (a, b, descending) { if (a.daysLeft == 'Not start

Kendo UI for Angular custom sorting grid columns

h3li0s I have the following column in Kendo Grid (Jquery's UI) which has a special sorting method based on customer needs. field: "daysLeft", title: "Accessible", width: 130, sortable: { compare: function (a, b, descending) { if (a.daysLeft == 'Not start

Kendo UI for Angular custom sorting grid columns

h3li0s I have the following column in Kendo Grid (Jquery's UI) which has a special sorting method based on customer needs. field: "daysLeft", title: "Accessible", width: 130, sortable: { compare: function (a, b, descending) { if (a.daysLeft == 'Not start

How to add classes to grid columns using angular-ui-grid?

Anita Mehta I'm using UI-GRID and have to add custom CSS to the grid's header, so I'm trying to add classes to the columns. $scope.columns = [ { name: 'status', displayName: 'STATUS', width: 200, pinnedLeft: true, **cellClass : "gridColumnSty

How to add classes to grid columns using angular-ui-grid?

Anita Mehta I'm using UI-GRID and have to add custom CSS to the grid's header, so I'm trying to add classes to the columns. $scope.columns = [ { name: 'status', displayName: 'STATUS', width: 200, pinnedLeft: true, **cellClass : "gridColumnSty

How to add classes to grid columns using angular-ui-grid?

Anita Mehta I'm using UI-GRID and have to add custom CSS to the grid's header, so I'm trying to add classes to the columns. $scope.columns = [ { name: 'status', displayName: 'STATUS', width: 200, pinnedLeft: true, **cellClass : "gridColumnSty

How to add classes to grid columns using angular-ui-grid?

Anita Mehta I'm using UI-GRID and have to add custom CSS to the grid's header, so I'm trying to add classes to the columns. $scope.columns = [ { name: 'status', displayName: 'STATUS', width: 200, pinnedLeft: true, **cellClass : "gridColumnSty