How to hide columns in an editable grid?

Is this possible? I have an editable grid in which I'm adding rows dynamically. I want to be able to hid one of the columns given a condition. I know I can do it with a paging grid. But the setup for an editable grid is different.

I tried adding "showWhen: false()" to the different parts of it, header, column config and the column data itself but it doesn't actually work. 

My guest is that the issue has to do with the dynamic rows. When I tried to add a new row I get the error message "Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridLayout: A grid layout component [label=“”] has an invalid value for “rows”. Every row layout must have the same number of components and it must match the number of header cells. The row at index 1 has 4 component(s). Expected: 3 component(s)."

 

Has anyone done something like this before?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi Jose,

    You can hide columns by adding a condition to the showWhen parameter of the a!gridLayoutHeaderCell() for that column, or just wrap that whole a!gridLayoutHeaderCell() in an if condition. You also need to implement the same logic on the component you are hiding within the gridRowlayout(). From the error message you posted it looks like you tried to hide a component in the gridRowLayout() but not the gridLayoutHeaderCell(). Hope that helps.
Reply
  • 0
    Certified Lead Developer
    Hi Jose,

    You can hide columns by adding a condition to the showWhen parameter of the a!gridLayoutHeaderCell() for that column, or just wrap that whole a!gridLayoutHeaderCell() in an if condition. You also need to implement the same logic on the component you are hiding within the gridRowlayout(). From the error message you posted it looks like you tried to hide a component in the gridRowLayout() but not the gridLayoutHeaderCell(). Hope that helps.
Children
No Data