RowSelect Event - Primary - dataTable

You must capture the rowSelect event for a dataTable that has a row selection based on a checkbox. The code is as follows:

<p:ajax event="rowSelect" listener="#{articleBean.onRowSelect}"
                    oncomplete="articleBean.onSelection" />
<p:ajax event="rowUnselect" listener="#{articleBean.onRowUnselect}"
                    oncomplete="articleBean.onSelection" />
<p:column id="name" headerText="Select" selectionMode="multiple"
                    style="width:18px" />

I can not understand the behavior. When I check the box for the first time, the onRowSelect method is called. When I deselect, "onRowUnselect" will not be called. In addition, the onRowSelect method is called only once for the grid, as if I click on any other flag, the event does not fire. Am I missing something? Not able to understand this behavior.

Thanks Shikha

+5
source share
1 answer

Since you are using dataTable with a checkbox based row select, you should replace:

<p:ajax event="rowSelect"
<p:ajax event="rowUnselect"

With the following:

<p:ajax event="rowSelectCheckbox"
<p:ajax event="rowUnselectCheckbox"
+15
source

All Articles