Skip to main content
Known Participant
Apr 10, 2024 9:27 AM UTC
Solved

How can we apply show when condition for particular rows in an Editable Grid?

Hi @all,

Can anybody help me in figuring out how we can apply show when condition for particular rows in an Editable Grid.

My use case is to show all the rows initially but when we select any row, rest of the rows hide out and only that row remains in the grid.

I am attaching an image of the interface of my editable grid:

Highly appreciate your efforts.

    stefanhelzle0001
    Brainy
    Apr 10, 2024 10:19 AM UTC

    In an editable grid, you create rows using a foreach and a!gridRowLayout(). Now, based on conditions, you can either skip the row entirely, or set showWhen of that row to false.

    6 replies

    Participating Frequently
    Apr 10, 2024 10:08 AM UTC

    Hi [mention:07fecfc9ac2942fcb65d4ac2b18a0037:e9ed411860ed4f2ba0265705b8793d05] 

    When you are selecting something, make sure that you are saving the particular primary key value in a variable, later filter the data where you are querying from.

    This should solve your issue.

    Regards,
    Achuth

    Known Participant
    Apr 12, 2024 11:38 AM UTC

    Thanks [mention:f150d8b666db4f8184c2c73197aeb201:e9ed411860ed4f2ba0265705b8793d05] , But we have no primary key, only unique indexes. And we also not querying from anywhere. We are just saving the data initially in a rule input whatever user is inputting in the grid.

    stefanhelzle0001
    Brainy
    Apr 10, 2024 10:19 AM UTC

    In an editable grid, you create rows using a foreach and a!gridRowLayout(). Now, based on conditions, you can either skip the row entirely, or set showWhen of that row to false.

    Known Participant
    Apr 12, 2024 11:49 AM UTC

    Thanks [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] for your help, it worked!

    harshitb6843
    Brainy
    Apr 10, 2024 11:06 AM UTC

    There are several ways of doing it, but the first step would be to store an identifier for the row you want to keep visible. Now in the gridRowLayout's showWhen you can add a condition which is something like this 

    a!gridRowLayout(
      showWhen: local!selectedRowIndex=fv!index
    )

    Known Participant
    Apr 12, 2024 11:48 AM UTC

    Thank you [mention:b8ea18cfbb2e4f6d841cf3c1d4d7420b:e9ed411860ed4f2ba0265705b8793d05] , It solved my problem.
    Appreciate your help!