Check Box Select/Deselect All on Grid

The below function is to be used on a grid with multiple check boxes. Place the code behind a FieldChange event and users will have the option to Select or Deselect grid rows all at once.

Fucntion selectAllRows (&rs As Rowset )
   Local number &i;
   Local Row &row;
   
    For &i = 1 To &rs. ActiveRowCount
      &row = &rs. GetRow (&i );
      /* Make sure we only select visible rows. */
      If &row. Visible = True Then
         &row. Selected = True;
      End- If;
   End- For;
end-function;

/*main line*/
Local Rowset &rs;
&rs = GetLevel0 ( ) ( 1 ). GetRowset (Scroll. scroll_table );

/*Call Function*/
selectAllRows (&rs );

The same code would work for multiple check boxes "Deselect All", just change the name of the function and line &row.Selected = True; to &row.Selected = False;

Make sure the Multiple Row (Check Box) is checked on the grid properties.

转载于:https://www.cnblogs.com/GoDevil/archive/2008/08/11/1264890.html

猜你喜欢

转载自blog.csdn.net/weixin_33827731/article/details/94608491
Box
今日推荐