How to dynamically recreate datagrid columns at runtime?how to create a table in Angular2 using jsonKendo-ui-angular2 grid: how to force the grid to redraw?PrimeNG - datatable: How to dynamically load columns and their fields in primeNg datatable?angular primeng dynamic columnsChange specific button text on click inside ngForDynamically load multiple dropdown in formarray in angular 6Dynamic mat-select option in form-arrayHow to generate a type at runtime in angularHow to dynamically create angular-kendo grid columns using columns settings?How to add input fields dynamically in angular 6
Is it really necessary to have 4 hours meeting in Sprint planning?
Сardinality estimation of partially covering range predicates
How to create a grid following points in QGIS?
How to fix folder structure in Windows 7 and 10
Norwegian refuses EU delay (4.7 hours) compensation because it turned out there was nothing wrong with the aircraft
What did the controller say during my approach to land (audio clip)?
What was an "insurance cover"?
Why are Fuji lenses more expensive than others?
Debussy as term for bathroom?
CDG baggage claim before or after immigration?
Is the sentence "何でも忘れた" correct?
In a jam session, when asked which key my non-transposing instrument (like a violin) is in, what do I answer?
Asking an expert in your field that you have never met to review your manuscript
Do the villains know Batman has no superpowers?
Pseudo Game of Cups in Python
Simulate a 1D Game-of-Life-ish Model
Social leper versus social leopard
How does one calculate the distribution of the Matt Colville way of rolling stats?
Safely hang a mirror that does not have hooks
Is there any actual security benefit to restricting foreign IPs?
What was the deeper meaning of Hermione wanting the cloak?
Why do different vector<bool> elements share the same address?
Can one guy with a duplicator initiate a nuclear apocalypse?
Why are some of the Stunts in The Expanse RPG labelled 'Core'?
How to dynamically recreate datagrid columns at runtime?
how to create a table in Angular2 using jsonKendo-ui-angular2 grid: how to force the grid to redraw?PrimeNG - datatable: How to dynamically load columns and their fields in primeNg datatable?angular primeng dynamic columnsChange specific button text on click inside ngForDynamically load multiple dropdown in formarray in angular 6Dynamic mat-select option in form-arrayHow to generate a type at runtime in angularHow to dynamically create angular-kendo grid columns using columns settings?How to add input fields dynamically in angular 6
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm calling an API service that returns a JSON array. I also have a code in the front-end that composes a list of columns or fields based on the JSON. This list of columns is not a fixed-list and can be different based on the JSON content. So, I need to recreate the data grid columns dynamically at runtime.
It works when using *ngFor directive and loop through an array of columns that is pre-defined or pre-initialized in the code but, I need to change the list of columns at runtime.
Example:
<clr-dg-column *ngFor="let field of fields" [clrDgField]="field.name">
field.text
</clr-dg-column>
let fields = [ name: "id", text: "Id" , name: "name", text: "Name" ];
changeFields()
this.fields = [ name: "userId", text: "User Id" , name: "desc", text: "Description" ];
When the changeFields()
function is called, I expected the datagrid columns to be changed to the new list of columns. But the problem is that it doesn't re-render the columns.
The example below, shows the first image with the initial columns of the data grid, the 2nd image shows blank columns when changed at run-time
Before changing the fields variables:
After changing the fields at run-time:
angular vmware-clarity
add a comment
|
I'm calling an API service that returns a JSON array. I also have a code in the front-end that composes a list of columns or fields based on the JSON. This list of columns is not a fixed-list and can be different based on the JSON content. So, I need to recreate the data grid columns dynamically at runtime.
It works when using *ngFor directive and loop through an array of columns that is pre-defined or pre-initialized in the code but, I need to change the list of columns at runtime.
Example:
<clr-dg-column *ngFor="let field of fields" [clrDgField]="field.name">
field.text
</clr-dg-column>
let fields = [ name: "id", text: "Id" , name: "name", text: "Name" ];
changeFields()
this.fields = [ name: "userId", text: "User Id" , name: "desc", text: "Description" ];
When the changeFields()
function is called, I expected the datagrid columns to be changed to the new list of columns. But the problem is that it doesn't re-render the columns.
The example below, shows the first image with the initial columns of the data grid, the 2nd image shows blank columns when changed at run-time
Before changing the fields variables:
After changing the fields at run-time:
angular vmware-clarity
Do you have a simple reproduction of what you are doing exactly so we can more easily triage the request? We have starters at stackblitz.com/@clr-team
– Jeremy Wilken
Mar 28 at 19:15
1
@JeremyWilken Sorry, I just incorrectly used the datagrid. It's now working perfectly. Here's what I'm currently working on. What I'm trying to achieve is to dynamically generate columns based on the keys of the first record in a JSON array. You can check this StackBlitz if you're curious about it: stackblitz.com/edit/clarity-light-theme-v1-0-oadj7e
– Wendell
Mar 29 at 11:19
add a comment
|
I'm calling an API service that returns a JSON array. I also have a code in the front-end that composes a list of columns or fields based on the JSON. This list of columns is not a fixed-list and can be different based on the JSON content. So, I need to recreate the data grid columns dynamically at runtime.
It works when using *ngFor directive and loop through an array of columns that is pre-defined or pre-initialized in the code but, I need to change the list of columns at runtime.
Example:
<clr-dg-column *ngFor="let field of fields" [clrDgField]="field.name">
field.text
</clr-dg-column>
let fields = [ name: "id", text: "Id" , name: "name", text: "Name" ];
changeFields()
this.fields = [ name: "userId", text: "User Id" , name: "desc", text: "Description" ];
When the changeFields()
function is called, I expected the datagrid columns to be changed to the new list of columns. But the problem is that it doesn't re-render the columns.
The example below, shows the first image with the initial columns of the data grid, the 2nd image shows blank columns when changed at run-time
Before changing the fields variables:
After changing the fields at run-time:
angular vmware-clarity
I'm calling an API service that returns a JSON array. I also have a code in the front-end that composes a list of columns or fields based on the JSON. This list of columns is not a fixed-list and can be different based on the JSON content. So, I need to recreate the data grid columns dynamically at runtime.
It works when using *ngFor directive and loop through an array of columns that is pre-defined or pre-initialized in the code but, I need to change the list of columns at runtime.
Example:
<clr-dg-column *ngFor="let field of fields" [clrDgField]="field.name">
field.text
</clr-dg-column>
let fields = [ name: "id", text: "Id" , name: "name", text: "Name" ];
changeFields()
this.fields = [ name: "userId", text: "User Id" , name: "desc", text: "Description" ];
When the changeFields()
function is called, I expected the datagrid columns to be changed to the new list of columns. But the problem is that it doesn't re-render the columns.
The example below, shows the first image with the initial columns of the data grid, the 2nd image shows blank columns when changed at run-time
Before changing the fields variables:
After changing the fields at run-time:
angular vmware-clarity
angular vmware-clarity
asked Mar 28 at 14:51
WendellWendell
664 bronze badges
664 bronze badges
Do you have a simple reproduction of what you are doing exactly so we can more easily triage the request? We have starters at stackblitz.com/@clr-team
– Jeremy Wilken
Mar 28 at 19:15
1
@JeremyWilken Sorry, I just incorrectly used the datagrid. It's now working perfectly. Here's what I'm currently working on. What I'm trying to achieve is to dynamically generate columns based on the keys of the first record in a JSON array. You can check this StackBlitz if you're curious about it: stackblitz.com/edit/clarity-light-theme-v1-0-oadj7e
– Wendell
Mar 29 at 11:19
add a comment
|
Do you have a simple reproduction of what you are doing exactly so we can more easily triage the request? We have starters at stackblitz.com/@clr-team
– Jeremy Wilken
Mar 28 at 19:15
1
@JeremyWilken Sorry, I just incorrectly used the datagrid. It's now working perfectly. Here's what I'm currently working on. What I'm trying to achieve is to dynamically generate columns based on the keys of the first record in a JSON array. You can check this StackBlitz if you're curious about it: stackblitz.com/edit/clarity-light-theme-v1-0-oadj7e
– Wendell
Mar 29 at 11:19
Do you have a simple reproduction of what you are doing exactly so we can more easily triage the request? We have starters at stackblitz.com/@clr-team
– Jeremy Wilken
Mar 28 at 19:15
Do you have a simple reproduction of what you are doing exactly so we can more easily triage the request? We have starters at stackblitz.com/@clr-team
– Jeremy Wilken
Mar 28 at 19:15
1
1
@JeremyWilken Sorry, I just incorrectly used the datagrid. It's now working perfectly. Here's what I'm currently working on. What I'm trying to achieve is to dynamically generate columns based on the keys of the first record in a JSON array. You can check this StackBlitz if you're curious about it: stackblitz.com/edit/clarity-light-theme-v1-0-oadj7e
– Wendell
Mar 29 at 11:19
@JeremyWilken Sorry, I just incorrectly used the datagrid. It's now working perfectly. Here's what I'm currently working on. What I'm trying to achieve is to dynamically generate columns based on the keys of the first record in a JSON array. You can check this StackBlitz if you're curious about it: stackblitz.com/edit/clarity-light-theme-v1-0-oadj7e
– Wendell
Mar 29 at 11:19
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400598%2fhow-to-dynamically-recreate-datagrid-columns-at-runtime%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400598%2fhow-to-dynamically-recreate-datagrid-columns-at-runtime%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you have a simple reproduction of what you are doing exactly so we can more easily triage the request? We have starters at stackblitz.com/@clr-team
– Jeremy Wilken
Mar 28 at 19:15
1
@JeremyWilken Sorry, I just incorrectly used the datagrid. It's now working perfectly. Here's what I'm currently working on. What I'm trying to achieve is to dynamically generate columns based on the keys of the first record in a JSON array. You can check this StackBlitz if you're curious about it: stackblitz.com/edit/clarity-light-theme-v1-0-oadj7e
– Wendell
Mar 29 at 11:19