How to dynamically add custom columns in Ag-Grid


shivek parmar

I am stacking to dynamically add custom columns in ag-grid. I have tried the following methods.

additionalCol = { field:'SOME RANDOM', headerName: 'SOME RANDOM' };
$scope.gridOptions.columnApi.addValueColumn(additionalCol);

I also tried

$scope.columns.push(additionalCol);
$scope.gridOptions.api.refreshView();

But without success. I even tried adding columns that exist in the data but failed. Below is an image of what I am trying.enter image description here

As shown, "%dev" is a "custom" column that I need to add dynamically using dynamically calculated values.

Alexander Zbinden

Try this:

var columnDefs = $scope.gridOptions.columnDefs;
columnDefs.push({ field:'SOME RANDOM', headerName: 'SOME RANDOM'});
$scope.gridOptions.api.setColumnDefs(columnDefs);

Related


How to dynamically add custom columns in Ag-Grid

shivek parmar I am stacking to dynamically add custom columns in ag-grid. I have tried the following methods. additionalCol = { field:'SOME RANDOM', headerName: 'SOME RANDOM' }; $scope.gridOptions.columnApi.addValueColumn(additionalCol); I also tried $scope.c

How to dynamically add custom columns in Ag-Grid

Shivek Parma I am stacking to dynamically add "custom" columns in ag-grid. I have tried the following methods. additionalCol = { field:'SOME RANDOM', headerName: 'SOME RANDOM' }; $scope.gridOptions.columnApi.addValueColumn(additionalCol); I also tried $scope.

How to dynamically add custom columns in Ag-Grid

Shivek Parma I am stacking to dynamically add "custom" columns in ag-grid. I have tried the following methods. additionalCol = { field:'SOME RANDOM', headerName: 'SOME RANDOM' }; $scope.gridOptions.columnApi.addValueColumn(additionalCol); I also tried $scope.

How to dynamically add custom columns in Ag-Grid

shivek parmar I am stacking to dynamically add custom columns in ag-grid. I have tried the following methods. additionalCol = { field:'SOME RANDOM', headerName: 'SOME RANDOM' }; $scope.gridOptions.columnApi.addValueColumn(additionalCol); I also tried $scope.c

How to dynamically add custom columns in Ag-Grid

shivek parmar I am stacking to dynamically add custom columns in ag-grid. I have tried the following methods. additionalCol = { field:'SOME RANDOM', headerName: 'SOME RANDOM' }; $scope.gridOptions.columnApi.addValueColumn(additionalCol); I also tried $scope.c

Angular-Ag-Grid - Dynamically add columns

Helen In 2 cases, I need to add some columns to Ag-grid. In other cases, I just need the base column. So in the constructor, I declare the grid like this: this.gridOption.columnDefs = [ { headerName: 'Admission date', field: 'admissionPlanned

Angular-Ag-Grid - Dynamically add columns

Helen In 2 cases, I need to add some columns to Ag-grid. In other cases, I just need the base column. So in the constructor, I declare the grid like this: this.gridOption.columnDefs = [ { headerName: 'Admission date', field: 'admissionPlanned

How to dynamically add row styles? -Ag-grid

knowledge I want to dynamically change the style of rows in ag-grid. What I'm trying to achieve is that if the user has edited the background color of the ag-grid row, the row changes. cellValueChanged(event) { //Add it only if the old value has changed if

How to dynamically add row styles? -Ag-grid

knowledge I want to dynamically change the style of rows in ag-grid. What I'm trying to achieve is that if the user has edited the background color of the ag-grid row, the row changes. cellValueChanged(event) { //Add it only if the old value has changed if

Dynamically add grid columns

Olaru Mircea I created a form with a single data source: InventJournalTable. I also added a grid on it and added two fields to the datasource: JournalTypeandJournalId This ActionPanehas a button and in its click event handler, I'm trying to do the following: 1

Dynamically add grid columns

Olaru Mircea I created a form with a single data source: InventJournalTable. I also added a grid on it and added two fields to the datasource: JournalTypeandJournalId This ActionPanehas a button and in its click event handler, I'm trying to do the following: 1

How to hide columns in Ag Grid?

Nicola Vias I'm fetching data from database and populating it by adding a column of manual action buttons in Ag-Grid. Now the first column contains those action buttons and the second column contains the _id, I want to hide the second column, but in the ag-gri

How to hide columns in Ag Grid?

Nicola Vias I'm fetching data from database and populating it by adding a column of manual action buttons in Ag-Grid. Now the first column contains those action buttons and the second column contains the _id, I want to hide the second column, but in the ag-gri

How to hide columns in Ag Grid?

Nicola Vias I'm fetching data from database and populating it by adding a column of manual action buttons in Ag-Grid. Now the first column contains those action buttons and the second column contains the _id, I want to hide the second column, but in the ag-gri

Dynamically add rows/columns to grid

water quality I have a child UserControlconsisting of multiple textboxes, labels, images, etc. I need to populate this user control in a "parent user" control that has a grid. The number of child user controls that need to be populated in the parent user contr

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 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

How to make Ag-Grid sort %columns

username I have columns in React Ag-Grid that sort by percentage column (like 5.08%) as strings. How can I get ag-grid to sort it into numeric values? The data from the server is already formatted as 0.00 and there is a cell renderer with a % sign appended. th

How to make Ag-Grid sort %columns

username I have columns in React Ag-Grid that sort by percentage column (like 5.08%) as strings. How can I get ag-grid to sort it into numeric values? The data from the server is already formatted as 0.00 and there is a cell renderer with a % sign appended. th

How to hide columns in AG-Grid?

sword How can I hide this column in AG-Grid and this column should also not be shown in tool panel... var columnDefs = [{ headerName: "Stone_ID", field: "Stone_ID", width: 100, hide: "true" }] Ishwor Timilsina You can set suppressToolPanel 's column property

How to make Ag-Grid sort %columns

username I have columns in React Ag-Grid that sort by percentage column (like 5.08%) as strings. How can I get ag-grid to sort it into numeric values? The data from the server is already formatted as 0.00 and there is a cell renderer with a % sign appended. th

How to make Ag-Grid sort %columns

username I have columns in React Ag-Grid that sort by percentage column (like 5.08%) as strings. How can I get ag-grid to sort it into numeric values? The data from the server is already formatted as 0.00 and there is a cell renderer with a % sign appended. th