Primefaces datatable reset pagination - primefaces

I am using the dataTable component with the paginator in a search utility which works great but having a problem to reset paginator page to the first page.
for example you are on page 6 of the paginator and you perform a new search, the dataTable gets reloaded with the new data but, the page number is not reset to 1 it remains on 6.
I'm using PF 3.4.2.
any idea?

Add the following javascript to the action which updates the DataTable's model:
onclick="myWidgetVar.getPaginator().setPage(0);"
Where myWidgerVar is the WidgetVar for the DataTable.
Ensure that the DataTable has a WidgetVar set. For further context, see this post by Optimus Prime.
The above causes the grid to make a call to refresh data with existing filters. If you explicitly want the grid to load new data from page one, you can reset the datatable on server side
DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("dialogSelectionForm:carSelectDialogTable");
dataTable.reset();
Reference - http://forum.primefaces.org/viewtopic.php?f=3&t=5807

I solved with widgetVarDataTable.clearFilters(); in primefaces 3.5,
and PF('widgetVarDataTable').clearFilters(); in primefaces 5.0

I solved my problem using PF('dataTableWidgetVar').paginator.setPage(0); in Primefaces 6.0

I had to solve this need in the back-end. To solve the problem without executing some sort of "duplicated refresh" I did implement this:
<p:commandButton ... update="dataTable" actionListener="#{myController.bindingDataTable.setFirst(0)}" oncomplete="someClientJS();" ... />
This code assumes the dataTable in the front-end is binding to the back-end reference variable myController.bindingDataTable. The ActionListener executes before the dataTable gets refreshed, so for that moment the paging is set with '0' as value for the first row/record (hence, first page as well).

Related

PrimeFaces AccordionPanel with paginator

I'm trying to implement paginator (or something like these) with accordionPanel in PrimeFaces, There is not a single example present in primefaces demo website,I searched in web as well,Is it possible to implement paginator with accordionPanel?
If you want paginator in accordionPanel then sorry, it's not possible. However if you are trying to implement datatable inside accordionPanel and in that if you want paginator then it's possible. I am pretty sure there is example present of datatable as well as accordionPanel you need to combine them it should work.

Using p:picklist to a large item list

I have the current code to get a list of item using a picklist in Primefaces:
<p:pickList showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" label="#{msg.dataview_label_net}" id="pickListNet" converter="firstItemConverter" value="#{dataViewBean.net}" var="node" itemLabel="#{item.name}" itemValue="#{item}" />
But, I have an issue with performance at the Google Chrome to show this list.
My backend is fast, but, to show all item in Primefaces there is a long time to render. Is it possible using some pagination in a picklist or some like lazy load?
I have around 3000 items in my list. I tried a js fix to improve in here:
https://code.google.com/p/primefaces/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20TargetVersion%20Reporter%20Owner%20Summary&groupby=&sort=&id=7655
but it's not working good for me.
The best solution for this issue is try another component like a DataTable.
I used a DataTable with a multiple checkbox and a lazy scroll to show only a partial list. My time to load reduce from 1min15s to 15s.
No, sorry this is not supported in the versions of PrimeFaces at this time of writing (5.1/5.2-SNAPSHOT). As could have been found out by lookin at the PrimeFaces documentation
i'm using primeng and i've faced the problem of pagination, i bring data from API, by 20 elements each call, the solution was to get the list element UL of the source by className and check if scroll is in the limit, if yes i make a new call of the api with page+1 and concatenate the data

primefaces empty selectItemGroup using filter

I'm using primefaces. Problem is with SelectOneMenu. Does anyone know if I can, when using filter in SelectOneMenu, remove SelectItemGroups which become empty?

how to use in condition in yii

I am facing this problem that how to use in conditon in yii.
I want to make a CListView in a tab which the tab number not at first.
How can I do ajax pagination on CListView, so I don't get the page refreshing but only the CListView instead ?
Call this in javascript: $.fn.yiiListView.update('id-of-your-listview');
the same for grid view: $.fn.yiiGridView.update

start in-cell-editing a row in primefaces datatable using context menu

I'd like to trigger in-cell-editing in a dataTable from a context menu edit command. I'm using primesfaces 3.4.1. I only found examples for editing using p:column/p:rowEditor (which is working fine). Context-menu examples span delete/view only but not editing.
Thanx in advance
hp