In my jsf page, there is a table using rich:dataTable, each row of table has a h:selectBoolenCheckbox, I want to use it to check some rows and then click a button to trigger action only for the checked rows.
And also there is a4j:poll component used in this page, every 15 seconds the table data will be refreshed. After that problem is coming:
my a4j:poll will invoke an action to load the latest data, the loading time need 2-4 seconds. If I click some checkbox to select some rows during the loading period, the checked checkbox will be lost after loading finish.
So do you met the same problem and how to avoid it?
Just don't update the whole table. Update only the cells which really need to be updated. You can use EL in reRender (RF 3.x) or render (RF 4.x) attribute of <a4j:poll> to dynamically populate a spaceseparated string of client IDs of all cells.
Related
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()
When I add a row from "Create.jsf" page and I go to "List.jsf" to see the datatable I get the same result before adding the row.
I have two solutions :
1 - I must clean browser cache everytime I want to see the new row or add a button to update the datatable.
Or I change the Controller from SessionScope to RequestScope (it works but it's not a good idea because it takes a lot of time to load the list everytime).
any other solution please ?
Thank you :)
I am implementing a datatable and would like to limit the user to only be allowed to expand one datatable row at a time. If a user goes to expand a second row when another row is already expanded it will collapse the first row before expanding the second. Is this possible using primefaces? I am currently using Primefaces Version 3.0
PrimeFaces is just about to release an enhancement that adds a "rowToggle" event to their row expansion component. It should be in the next release after 3.3.1. It will allow you to handle the row toggle event. Once you have the ability to handle the toggle event, you will be able to write code that will collapse all rows other than the current toggled row. See here: https://code.google.com/p/primefaces/issues/detail?id=2277 which states that it will be included in the next deployment.
Note that they've already added an example of this new event to their showcase labs: http://www.primefaces.org/showcase-labs/ui/datatableExpandableRows.jsf, so it should be forthcoming.
Alternatively, you can leverage the "onExpandStart" attribute of <p:dataTable> to invoke client side code (Javascript) to collapse any rows which are in an expanded state.
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
So what I want is this (Just the collapsible part):
http://www.primefaces.org/showcase-labs/ui/layoutEvents.jsf;jsessionid=238C388CE45C77A9B90898A82F2340EA
With 2 differences.
I want it in a datatable
I want to make a custom button that will control whether or not they are collapsed
Is this possible if so is there a good example I can go off?
i would start by
creating the dataTable as you want it to look with the row fully 'expanded'
put the data to be toggled in a panelGroup
put some sort of toggle on the row
put an effect on the panelGroup
put an action on your toggle to show/hide the panelGroup for the row
Some component libraries have this. they call them 'expandible rows', some display the data in the row, some render the row(s) below the 'parent' one.
One issue that i found (in earlier versions) is that when you had the data display in a separate row and you had a paginator set to show a set rows to display, it would bump the last row(s) when expanding the requested row to expand. I don't know if that is still the case.