Posted 18 June 2020, 4:41 pm EST
Dear Wijmo Team,
I’m using Angular 8 to render grouped columns. It works fine until I want to manually set
this.flexgrid.coulmnLayout = JSON.stringify(columnState);
I need to do this because I need to save and restore the state of the columns to and from LocalStorage.
ColumnState and the result of JSON.stringify(columnState) hold the exact same data, but when printing out this.flexgrid.columnState all grouped columns are missing.
console.log("columnState: ", columnState);
console.log("JSON stringify columnState: ", JSON.stringify(columnState));
this.flexgrid.columnLayout = JSON.stringify(columnState);
console.log("this.flexgrid.columnLayout", this.flexgrid.columnLayout);
Result of JSON.stringify(columnState)
{
"dataType": 4,
"header": "Date",
"binding": "date",
"visible": true,
"format": "yyyyMMdd",
"isReadOnly": false,
"isRequired": false
},
{
"dataType": 1,
"header": "Group",
"columns": [
{
"dataType": 1,
"header": "attribute 1",
"binding": "attribute1.1219.content",
"visible": true,
"isReadOnly": false,
"isRequired": false
},
{
"dataType": 1,
"header": "attribute 2",
"binding": "attribute2.1274.content",
"visible": true,
"isReadOnly": true,
"isRequired": false
}
],
"binding": "group.1219.content",
"visible": true,
"isReadOnly": false,
"isRequired": false
}
Console.log of this.flexgrid.columnLayout after this.flexgrid.columnLayout = JSON.stringify(columnState)
{
"header": "Date",
"binding": "date",
"dataType": 4,
"format": "yyyyMMdd",
"allowDragging": false,
"isRequired": false
},
{
"header": "Attribute 1",
"binding": "attribute1.1219.content",
"dataType": 1,
"allowDragging": false,
"isRequired": false
},
{
"header": "Attribute 2",
"binding": "attribute2.1274.content",
"dataType": 1,
"format": "2000",
"allowDragging": false,
"isReadOnly": true,
"isRequired": false
}
Why does this happen?
Best regards
Moritz