显示或隐藏一个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 calledSpecify individual users and a grid used to enter individual users. Make sure you put your PeopleCode in both the FieldChange andRowInit 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.

posted @ 2013-10-24 13:56  Bryan chen  阅读(577)  评论(0编辑  收藏  举报