pzGridRadioButton - how to add to repeating Grid layout
Can you please let me know how to add pzGridRadioButton to repeating grid layout? I configured one of the column in repeating grid layout as Radio button property and I was looking for pzGridRadioButton control to configure it, but I don't this control listed(in the Display & Validation of the Property rule form).
The below reference from Pega Academy:
The latter Section uses a pzGridRadioButton Control within the Repeating Grid that it displays. When clicked, the pzGridRadioButton changes of the value of the @baseclass.pySelected TrueFalse property to “true”, at the same time changing the values of every other row’s @baseclass.pySelected property to “false”. This pzGridRadioButton is the reason why the D_Itineraries Data Page was set to “Editable”.
IF you are trying to add a radio button to a grid so you can use it to set a row selected (and use it like a radio button list) the LocalRadio control is the control I have been able to use in grids in version 6. I am in the process of verifying that functionality in 7 right now.
I'm not able to give you a screen shot at the moment, but in your grid add a column. When configuring the cell in the column, select "other" for the control type and then type in "Radio" which should bring up "LocalRadio" as a control type. After selecting the control type, select .pySelected as the associated property for the cell. For the grid itself, on the operations tab, ensure the Inline editing is enabled. That is all you should need to do. If you still are having difficulties, I can take some screenshots tomorrow and attach them to the response.
I did a little more work with this and found a better control to use: pyRadiobuttonsSelectable. You have to manually select it by using the change control link and then bind it to pySelected as shown below. To find the selected row, you would have a post action data transform or activity that would search for the row where pySelected = true. My preferred function for this is: @Utilities.IndexInPageList("true","pySelected", pagename.pxResults) . With the index, you can start pulling values or copying the page using the index reference.
One warning with this solution: if you are using this with a grid that uses pages, you will have to take a different approach because pySelected will only be unique across the currently displayed page. The solution for that requires using a LocalRadio control and calling an activity that loops through the data page and clears out all the other pySelected values. Writing the activity is tricky because you have to get a reference to the step page (for which there is function that can get you the page name) and depending on how fancy you need to be, you may want to pass in your pySelected value as an input param if you are trying to conditionally fire the clearing process.
The activity or the data transform configured on the control will be invoked in the row page context(i.e. if the radio button in 4th row is clicked then the activity / DT will be executed in DataPage.pxResults(4) page). So pxListSubscript property of the primary page should give you the currently selected row. Now the logic has to be written in such a way to reset all other pySelected properties by looping through the entire pagelist.
If you are in a paging scenario, then you have to write an activity that works something like this, so that you can get the reference to the correct data page as you may not have the params needed in order to find the data page directly.