How to hide column from a!gridField()

I am trying to hide a column from a!gridField() if certain condition is met using an IF statement. It is not working for me. Please see the document attached for details and the error message I am getting

supporting_document.txt

OriginalPostID-197530

OriginalPostID-197530

  Discussion posts and replies are publicly visible

Parents
  • @erickp Hi, rather than including a null in the value of 'headerCells', 'columnConfigs' and 'rows 'attributes, I would like to suggest to take a look at following alternatives:

    Option - 1: Use {} instead of null. But afaik this won't work in all cases.

    headerCells: {
    a!gridLayoutHeaderCell(
    label: ""
    ),
    \t if(
    \t ri!someProperty[1].property_int=6,
    a!gridLayoutHeaderCell(
    label: "testing",
    align: "RIGHT"
    ),
    \ t{}
    \t )
    }

    Option - 2: Provide a set of values derived based on a condition. This helps definitely in all cases and especially when Option - 1 fails.


    headerCells: if(
    \tri!someProperty[1].property_int=6,
    \t{
    a!gridLayoutHeaderCell(
    label: ""
    )
    },
    \t{
    a!gridLayoutHeaderCell(
    label: ""
    ),
    a!gridLayoutHeaderCell(
    label: "testing",
    align: "RIGHT"
    )
    }
    \t)

    To the best of my knowledge, one of the either options discussed above should do the job and do let us know if you have follow-up questions.
Reply
  • @erickp Hi, rather than including a null in the value of 'headerCells', 'columnConfigs' and 'rows 'attributes, I would like to suggest to take a look at following alternatives:

    Option - 1: Use {} instead of null. But afaik this won't work in all cases.

    headerCells: {
    a!gridLayoutHeaderCell(
    label: ""
    ),
    \t if(
    \t ri!someProperty[1].property_int=6,
    a!gridLayoutHeaderCell(
    label: "testing",
    align: "RIGHT"
    ),
    \ t{}
    \t )
    }

    Option - 2: Provide a set of values derived based on a condition. This helps definitely in all cases and especially when Option - 1 fails.


    headerCells: if(
    \tri!someProperty[1].property_int=6,
    \t{
    a!gridLayoutHeaderCell(
    label: ""
    )
    },
    \t{
    a!gridLayoutHeaderCell(
    label: ""
    ),
    a!gridLayoutHeaderCell(
    label: "testing",
    align: "RIGHT"
    )
    }
    \t)

    To the best of my knowledge, one of the either options discussed above should do the job and do let us know if you have follow-up questions.
Children
No Data