Using the AllowSelection property

Objective

Sometimes, an user must select a row in a Grid (WPD) in order to perform an action on it. This can be done using an action inside the columns or free style section,  an action with row selection = single, or using the AllowSelection property in the grid.

It is recommended to read the GeneXus documentation about the AllowSelection property before continuing. It is important to know the difference between this property, and the "Row Selection" property available in action nodes.

How it works

Inside the tree specification used by K2BWebPanelDesigner, grid nodes include a property called "AllowSelection", which establishes whether selection will be allowed for grid nodes or not. When this property is set to true, selection is allowed for grid rows.

AllowSelectionRT
Grid with allow selection set to true

When the user clicks on a row it is selected. In the image shown above the visual effect of selecting a row can be seen. In this case, the 6th row was selected.

The developer can customize what the occurs when a row is selected by implementing an user subroutine called "U_OnLineActivate({InternalName})" (where "{InternalName}" is replaced by the name of the grid). In the example above, the developer programmed the user subroutine so that when a row (corresponding to a product) is selected, the product's definition is shown below. This is done using a web component showing the product transaction in display mode. To acomplish this, the developer added the code shown below to the generated user subroutine.

AllowSelectionCode
"U_OnLineActivate({InternalName})" Code (when Generate OnLineActivate Event property is set to true)


IMPORTANT NOTE:

When AllowSelection is set to true a property named GenerateOnLineActivateEvent appears inside grid node. This property was included to maintain backwards compatibility with previous versions of K2BWebPanelDesigner where the AllowSelection property was not avaiable, and developers had to code the event Grid.OnLineActivate directly. If this property is set to "False" no event is generated by K2BWebPanelDesigner, levaing the developer's implementation intact. When the property is set to true the event Grid.OnLineActivate is generated with a call to the user subroutine named "U_OnLineActivate({InternalName})", where "{InternalName}" is replaced by the name of the grid.

AllowSelectionPropeties
The "Generate OnLineActivate Event" property