Grouped Columns: Setting flexgrid.columnLayout

Posted by: moritz.neugebauer on 18 June 2020, 4:41 pm EST

  • 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

  • Posted 20 June 2020, 7:30 pm EST

    Hi Moritz,

    This seems like a bug. We have forwarded this to the developers with internal tracking id 441883. We will update you once this issue is fixed.

    Regards,

    Ashwin

  • Posted 21 June 2020, 4:03 pm EST

    Dear Ashwin,

    thank you for letting me know. I’m using Wijmo version 5.20193.637.

    Best regards

    Moritz

  • Posted 21 December 2020, 10:47 pm EST

    Hi Moritz,

    The developers have said that this is a limitation because the columnLayout property only takes into account the bound columns and the columnGroups property creates hierarchical columns where only the last level columns are bound. Therefore, these are the only columns which are added to the columnLayout.

    ~regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels