Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

addRowData is not working #499

Open
emmanuelfernandez opened this issue Aug 7, 2020 · 0 comments
Open

addRowData is not working #499

emmanuelfernandez opened this issue Aug 7, 2020 · 0 comments

Comments

@emmanuelfernandez
Copy link

emmanuelfernandez commented Aug 7, 2020

I have a use case where I need to add more json data to my grid from an external source.
The issue is that every time I execute "addRowData" the rows are empty for all the columns that do not have a a formatter.

Here is an example not working for version 4.15.5
https://jsfiddle.net/dsmvy47n/1/

The JSON I need to consume has several nested fields, here is an example like the field "countryInfo"
var data = [
{ continent: "Africa", countryInfo: {name: "Congo", rank: 5, populationCount: 9999 }},
{ continent: "Africa", countryInfo: {name: "Ghana", rank: 3, populationCount: 9999 }},
{ continent: "Europe", countryInfo: {name: "Italy", rank: 1, populationCount: 9999 }},
{ continent: "Europe", countryInfo: {name: "France", rank: 2, populationCount: 9999 }},
];

var colModel = [
{ name: "continent" },
{ name: "countryInfo.name", label: "contry"},
{ name: "countryInfo.rank", label: "rank"},
{ name: "countryInfo.population", formatter: populationFormatter}
];

I noticed that that if the if the json was flatten, then "addRowData" would work
var data = [
{ continent: "Africa", countryName: "Congo", rank: 5, populationCount: 9999},
{ continent: "Africa", countryName: "Ghana", rank: 3, populationCount: 9999 },
{ continent: "Europe", countryName: "Italy", rank: 1, populationCount: 9999 },
{ continent: "Europe", countryName: "France", rank: 2, populationCount: 9999 },
];

var colModel = [
{ name: "continent" },
{ name: "countryName", label: "contry"},
{ name: "rank", label: "rank"},
{ name: "population", formatter: populationFormatter}
];

But I I have a lot of code consuming nested json depending on "addRowData" to work and change hundreds of reports. FYI this was working before in version 4.7.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant