Topic: Custom column label from Other JSON structures
Teerapong free asked 5 years ago
from this example with Other JSON structures
mounted(){
fetch('https://jsonplaceholder.typicode.com/todos')
.then(res => res.json())
.then(json => {
let keys = ["id", "title", "completed"];
let entries = this.filterData(json, keys);
//columns
this.columns = keys.map(key => {
return {
label: key.toUpperCase(),
field: key,
sort: 'asc'
};
});
//rows
entries.map(entry => this.rows.push(entry));
})
.catch(err => console.log(err));
}
is it possible to custom label of column like
columns: [
{
label: 'Name',
field: 'name',
sort: 'asc'
},
{
label: 'Position',
field: 'position',
sort: 'asc'
},
I’m looking forward to your reply.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Opened
Specification of the issue
- ForumUser: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: 5.8.0
- Device: PC
- Browser: Chrome
- OS: Windows7
- Provided sample code: No
- Provided link: No
Magdalena Dembna staff commented 5 years ago
As I understand you would like to rename fields in data from API? I would suggest creating an array of desired columns and map entries from API to match those fields.