Sunday, 6 July 2025

Radio button-like behavior using checkboxes in a grid

 Following PeopleCode  enforces radio button-like behavior using checkboxes in a grid. When the user checks a checkbox in one row of the grid, it will automatically uncheck all others.


/* Place this code in the FieldChange event of X_SELECT */

Local Rowset &rs;

Local Row &row;

Local integer &rowCount;

/* Get the grid rowset */

&rs = GetLevel0().GetRow(1).GetRowset(Scroll.X_STD_INSTLMNTS);


For &i = 1 To &rs.ActiveRowCount

  

   /* Uncheck all other checkboxes */

   If &i <> CurrentRowNumber() Then

      

      &rs(&i).X_STD_INSTLMNTS.X_SELECT.Value = "N";

   Else

      /* Ensure the clicked row is checked */

      &rs(&i).X_STD_INSTLMNTS.X_SELECT.Value = "Y";

      

   End-If;

End-For;


No comments:

Post a Comment