Skip to content

addRowData is not working #499

Open
Open
@emmanuelfernandez

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions