Multiple Primefaces DataTables on one page have the same pagination index - jsf

I have a PrimeFaces 6.2 DataTable with rowExpansions. Each rowExpansion has another DataTable with pagination enabled. The whole construct is within a single form. The backing bean is a ViewScoped ManagedBean.
Selecting a row in a child table will update the parent table. The problem is now that when I change the pagination in a child table and select a row causing an update that the pagination in all other child tables gets the same index. So if for example I am on page while doing the change, all other tables will be on their page 2 as well. The same happens if change the pagination and open or reopen another rowExpansion. So, why on earth do these tables share the same pagination index?
I have already tried to put all child tables in a separate form. This changes nothing.

Related

prime face data table with pagination and data table is put inside Tab

every row I have a commandbutton for editing the row. The method action of this commandbutton sets a managed bean property to hide the datatable and to show the edit form. I do this by enclosing the datatable in a panelgroup, and the edit form in another one, and setting the rendered attribute of the panelgroups accordingly to the managed bean property.
The managed bean is Viewscoped, and all the requests I have are non-ajax.
When I click the edit commandbutton on a row of the 1st datatable page, everything works ok.
But if I move to another datatable page using the paginator links, and then I click the edit commandbutton on any row of the page, it doesn't work, because the Viewscoped bean is created again (PostConstruct is triggered), and even I can see that the action method of the clicked commandbutton isn't executed.
I think it has to do with the ajax requests of the paginator (I guess).
Anybody knows how to make it work?
The problem is with the rendered attribute. Take a look here.
A beter way of solving your problem is to make an editable datatable, or if your object is more complex, make your edit page a dialog, and open it with your edit button.

select All/deselect all checkbox in Datatable JSF without using Javascript

I am making datatable in JSF using (dataTable tag).
I am having several rows in that with check box( selectBooleanCheckbox ) in front of every record.
I have commandLink button for selecting all check box and deselected all check box..
i am trying to select/unselect all checkboxes in the datatable using a single commandLink. As I am trying to set it on the server, I am unable to do so. I have looked around for solutions but could not get how to accomplish on the server side.
thnks

How to add a row to h:dataTable dynamically without rerendering the whole table?

I want to add a row to a <h:dataTable> dynamically, but I don't want to rerender the whole datatable, because the user could have some of the rows expanded etc., which would be closed after the AJAX call.
Is it possible to do this in JSF?

How to restore the state of p:dataTable before dialog reopen?

I'm using the PrimeFaces 3.5. I have p:dialog in which is p:dataTable. This is used to pick the item from filtered list.
After selecting the item I'm hiding the dialog and de-rendering the data table. But after showing the dialog again and re-rendering the data table, the data table contains the rows from previous filtering, but the filters themselves are clear.
I'm using the lazy data loading, so the values point to LazyDataModel, and the filteredValues are not set.
I would like to have the dataTable again in default state, so that both filters and selected rows would be empty. How to do that?
From the source, it looks like you can call reset() on an instance of org.primefaces.component.datatable.Table which will
Clear filtered values
Clear filters
Reset it's value
So you should obtain a reference to the client side datatable (either by value binding or walking the DOM from event) and call table.reset()

Primefaces p:lightbox being added multiple times when sorting p:datatable

I am using primefaces 3.2 and JSF 2 running on GlassFish 3.1.2 and Java 6.
I have a p:lightbox component inside the column of a p:datatable. Basically, I want the user to be able to click a p:commandbutton in a row and then display some information associated with the current row.
This works fine normally, but if the user clicks on the header for a column to sort the rows, multiple lightboxes will appear when the user next clicks a p:commandbutton to display the lightbox. This is shown in the attached image. Also, not only do multiple lightboxes get appended, but the information no longer corresponds to the row where the p:commandbutton was clicked.
My question is, how can can I get this to work to display lightboxes from inside a p:datatable and still allow the table to be sorted using ajax?
This problem occurs in all 3 versions of the lightbox, even in iframe mode.
It seems that this could be related to a problem other people had with the lightbox and pf 3: http://forum.primefaces.org/viewtopic.php?f=3&t=18184

Resources