akveo / akveo/ng2-smart-table

How to dynamically set 'settings' configuration for dynamic columns/rows from backend?

Open
#362 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.6k
Forks
867
PR merge metrics
No merged PRs in 30d

Description

Hi, I am trying to assign the 'columns' value of 'settings' property by fetching the dynamic columns from backend. But its not working.

First of all, Settings property defined as
**settings={actions: false, columns: {} };**
along with new object test={}; // which will get assigned new dynamic columns value later in the code.

**Code:**
for (let i = 0; i < this.dynamicColumn.length; i++) {
console.log("dynamic headers from our backend are "+this.dynamicColumn[i]);
this.**test**[this.dynamicColumn[i]]={ title: this.dynamicColumn[i]};
}
this.settings.columns=this.**test**;

**And finaly in settings will look like below:** // Below is seen from console mode
[console.log("settings = "+JSON.stringify((this.settings)));]

settings = {
columns: {
id: {
title: 'id'
},
name: {
title: 'name'
},
username: {
title: 'username'
},
email: {
title: 'email'
}
}
};

_______________
Problem is :
When i define **settings={actions: false, columns: {} };** , my program wont work neither it gives any error. Is it possible to change the settings property at all dynamically ?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.