Immediate RowUnselect Event after RowSelect Event

UI Components for JSF
Post Reply
klaus_acc
Posts: 22
Joined: 14 Jun 2011, 17:04

15 Jun 2011, 10:26

[Edit: Now not using *listener anymore, but the according <p:ajax event>. Therefore now the events are triggered with the latest snapshot, but the the described effect is still the same]

Hi,

I have the following issue (verified in the following simplified setting):

If I have a page with a datable and lazy loading (but also occurs wihtout lazy loading). On this page I have a p:commandbutton navigating to another page. On this second page there is just a command button navigating back to the first page with the datatable. Back on the first page: If I select an item in the datatable my rowSelectListener method is fired, and immediately afterwards the rowUnselectListener method gets fired. This sound like it is the same effect as described (and solved) here.

The effect only occurs if go back to the page with the datatable - on my first visit on this page everything works fine.

To ensure the failure isn't just because of my usage of the datatable I used the code given in the showcase, made the TableBean SessionScoped, and just added commandButton navigating to another page, and on this page a commandButtong navigating back - therefore the issue should be easy to verify.

I found the issue using a one or two weeks old snapshot of 3.0.M2 and verfified it in 3.0.M1 . When trying to verify it with the newest Snapshot of 3.0.M2 (13-Jun-2011 20:02) the RowSelectListener didn't get fired.

I'm using
- Primefaces 3.0.M2-SNAPSHOT / 3.0.M1
- JSF 2.1.0
- Tomcat 6.0.29 (in a liferay-portal 6.0.6)

Can anyone verify this as bug, or give an idea how to handle it? Thanks!

Klaus
Last edited by klaus_acc on 16 Jun 2011, 12:37, edited 1 time in total.
primefaces-3.0.M3-SNAPSHOT | Mojarra 2.1.0-b08 | Tomcat 6.0.29 (in a liferay-portal 6.0.6)

klaus_acc
Posts: 22
Joined: 14 Jun 2011, 17:04

16 Jun 2011, 12:35

I fixed some issues with my dataTable (now not using *listener but <p:ajax> as you may have read in another Thread), and rowSelect Events are now triggered using the latest Snapshot.

However, the following still holds true: If I add a Commandbutton to a (sessionscoped) page wih a datable, navigate to another page, and then navigate back to the page with the datatable: on my next selection/unselection there are two ajax events triggered on the same row:

In case of a selection: A rowSelect event directly followed by a rowUnselect event.
In case of a unselection: A rowUnselect event directly followed by a rowSelect event

Thats's exactly the same effect as described (and solved in an older Thread - but different preconditions. There the same problem occured when a button with 'update="datatable_id"' was clicked. This is fixed, but going back to the page with the datatable seems to cause the same problem. On the first visit of the page with the datatable everything works fine. Any ideas what might cause this issue?
primefaces-3.0.M3-SNAPSHOT | Mojarra 2.1.0-b08 | Tomcat 6.0.29 (in a liferay-portal 6.0.6)

kevin207
Posts: 3
Joined: 14 May 2011, 06:47

27 Jun 2011, 09:01

Hi Klaus,

rowSelectListener of lazy loading data Table is not fired, and rowSelect Events are now triggered using the latest Snapshot.

In this problem short out with help of rowSelect event
First you check rowsPerPageTemplate, assigned selectedRow value & rowSelectListener for onRowSelect statement

Event rowSelectListener was not fired and the method onRowSelect was not stepped in.


Regards
Kevin Thomas
Attune Infocom Inc
http://www.attuneinfocom.com
Email : contact@attuneinfocom.com
Liferay Portlet

klaus_acc
Posts: 22
Joined: 14 Jun 2011, 17:04

30 Jun 2011, 13:04

Hi Kevin,

As written in the last post, I don't use the rowSelectListener anymore, but the ajax even rowSelect. But the problem is still the same.
Therefore, this is how my datatable looks like:

Code: Select all

<p:dataTable var="test" value="#{testBean.lazyModel}"
					lazy="true" selectionMode="single"
					selection="#{testBean.selectedTest}"
					rows="10">
					
					<p:ajax event="rowSelect" listener="#{testBean.onRowSelect}" update="continueButton" />
					<p:ajax event="rowUnselect" update="continueButton" />

					<p:column>
					...

Anyway, I have new information:
As described above: On the first visit to a page containing the datatable one rowSelect/unselect event is fired, and on the second visit two rowSelect rowUnselect events (taking turns). By now I realised, that it's three events on the third time, and so on...

I tried to debug for the source of this, but don't have any results, yet. The one thing I can say so far is, that in DataTableRenderer.decodeBehaviors(...) the local variable behaviours (and thus the UIComponent) already contains the different events, but I still don't know why they are caused like this.
primefaces-3.0.M3-SNAPSHOT | Mojarra 2.1.0-b08 | Tomcat 6.0.29 (in a liferay-portal 6.0.6)

llp0001
Posts: 5
Joined: 25 Mar 2010, 17:54

30 Jun 2011, 13:39

Hello:

On using snapshot 3M2 I did same changes like you on our Datatable
components removing onRowSelect attributes and change them to use p:ajax
An example:


We have some issues like you. For example our Datatables with
MULTIPLE instant Row selection, fire rows selection events with success but the array in backing bean with selected beans is not updated. Allways
the array contains 1 less element. If we select 3 rows, the array contains
only the 2 first selected rows. If we put a button (that dows submit) and after select the rows and click we check for selected rows then the array contains all selected rows.
The it seems a issue related with ajax update of selection array.
With primefaces v3M1 using onrowSelect datatable attributes (without p:ajax) then all works fine.

Any ideas???

Thanks in advance!!
any solution??

klaus_acc
Posts: 22
Joined: 14 Jun 2011, 17:04

19 Jul 2011, 17:47

I now figured ot the details of the issue.
Using primefaces in a portlet, it was possible to navigate using a <p:commandButton> which uses ajax (i.e. NO ajax = "false"). I know that this is not supported normally, but in portlets this seemed to work fine. However this is what causes this problem. Navigating without ajax requests (i.e. ajax = "false"), everything works fine.

Avoiding a complete page reload using ajax, when just the portlet needs to be changed and not the complete portal side is much nicer, however I still haven't found where the several events are caused. Therefore, I'll stay with ajax=false for now - at least if no one has some good ideas where to look for the reason ;)
primefaces-3.0.M3-SNAPSHOT | Mojarra 2.1.0-b08 | Tomcat 6.0.29 (in a liferay-portal 6.0.6)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests