Showing and Hiding a Grid

The Rowset class contains two methods that can be used to show and hide all rows:

  • ShowAllRows()
  • HideAllRows()

You can use these two methods to show or hide a grid on a page associated wtih a particular rowset. Simply make sure that the grid uses the main record that your rowset refers to, then refer to this scroll record using a rowset and call the methods to show or hide the grid.

This is particularly useful if you have a field that determines whether or not a grid should be displayed. For example, a check box field called Specify individual users and a grid used to enter individual users. Make sure you put your PeopleCode in both the FieldChange and RowInit methods to ensure consistency when showing/hiding your grid.

Also make sure that in your page properties, you have the Adjust Layout for Hidden Fields check box set. This ensures the page height adjusts dynamically based on whether or not the grid is visible, rather than leaving a big whitespace gap when it is hidden.

Note if you are receiving errors about modifying the current program context, move your code up a scroll level and then use ShowAllRows() or HideAllRows() from the higher level scroll on your rowset. You cannot use this code at the same scroll level as the grid itself.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License