How to Enable and Disable Grid Rows using PeopleCode

Grid
Aprat from using EnableColumns(&Array)and SetProperties(&Array
Grid Class methods Here is another ways you can enable and disable PeopleSoft grid rows using PeopleCode.
Code snippt as follows;
/* assume Grid main Record is SOME_RECORD */

Local Rowset &RS = GetRowset(Scroll.SOME_RECORD);   For &i = 1 To &RS.ActiveRowCount      For &l = 1 To &RS(&i).GetRecord(Record.SOME_RECORD).FieldCount       &RS(&i).GetRecord(Record.SOME_RECORD).GetField(&l).Enabled = False;      End-For;   End-For;

More complete example would be

/* Declare a Rowset Object */ 
Local Rowset &level1; 
/* Traverse the Grid which is at Level 1 */ 
/* Level 0 always has a single row - so access it and Get the Scroll */ 
&level1 = GetLevel0().GetRow(1).GetRowset(Scroll.SOME_RECORD) ; 

/* To Remove "Add Row" or "Delete Row" Buttons at the end of all rows in the Grid */ 
&level1.DeleteEnabled = False; 
&level1.InsertEnabled = False; 

/* For a Single Row of Level 0 Data, There can be multiple Rows of Level 1 Data */ 
/* So, Looping through all rows in the Grid */ 

For &i = 1 To &level1.ActiveRowCount 
/* To Gray a particular field on all rows */ 
/* Depends on the requirement you can use Enabled property as well*/
/* This is for existing/unchanged/already-saved rows */
&level1.GetRow(&i).SOME_RECORD.SOME_FIELD.DisplayOnly = True; 

/ * For new rows in the grid */
If &level1.GetRow(&i).IsNew = False Then 
&level1.GetRow(&i).SOME_RECORD.SOME_NEW_FIELD.DisplayOnly = True; 
End-If; 
/* To Remove "Delete Row" Button at the end of particular rows in the Grid */ 
&level1.GetRow(&i).DeleteEnabled = False; 
End-For;


SHARE

Ayesha Wee

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment