How to hide & unhide the grid from the page by using people code?

How to hide & unhide the grid from the page by using people code?

In the given example, user wants to hide and unhide the grid from the page by selecting the check box option on the page. If the check box is checked the grid should be visible else hide the grid & delete the values present in the grid.The check box is at level 0 & the grid is at level 1.

Function HideAllRows() can be used to hide the grid, & function ShowAllRows() can be used to unhide the grid.

HideAllRows hides all rows of the rowset.
For the given example, write the below people code at field change of check box.

1) Hide the grid.

   &Rowset0 = GetLevel0();
   &Row0 = &Rowset0(1);
   &Rowset1 = &Row0.GetRowset(Scroll.);
   &Rowset1.HideAllRows();

2) Delete the data from the grid

   &Rowset0 = GetLevel0();
   &Row0 = &Rowset0(1);
   &Rowset1 = &Row0.GetRowset(Scroll.);
   For &i = &Rowset1.ActiveRowCount To 1 Step - 1
      &Rowset1.DeleteRow(&i);
   End-For;

OR

If the data is present in the component buffer & not present in the data base, then use function flush() to delete the data from the buffer.

   &Rowset0 = GetLevel0();
   &Row0 = &Rowset0(1);
   &Rowset1 = &Row0.GetRowset(Scroll.);
   &Rowset1.flush();

3) Unhide the grid

   &Rowset0 = GetLevel0();
   &Row0 = &Rowset0(1);
   &Rowset1 = &Row0.GetRowset(Scroll.);
   &Rowset1.ShowAllRows();

 

1 comments:

  1. Anonymous said,

    &rs = GetLevel0()(1).GetRowset(Scroll.Z_PRO_2_PAY_VW);
    &rs.HideAllRows();

    on August 19, 2014 at 4:55 AM