DataTable Filter and Current Page

UI Components for JSF
martinezjavier
Posts: 17
Joined: 01 Feb 2010, 17:17

03 Feb 2010, 15:57

Hello I have two questions about the DataTable component.

1- How can I get the page number that my data table is showing. I have a page were the user can Generate two PDF from the data "Current Page" and "All". Im using JasperReports to generate the PDF, not the Data exporter so I have to ask the model the "current page" info.

I tried this

private DataTable dataTable;

binding="#{peopleController.dataTable}"

int currentPage = tablaPersonas.getPage();

But it always return 1 regarding wich page is showing the data table.

2- In the PDF documentation at the dataTable section it says that the data table supports a "global filter". According the docs, I defined

<h:inputText onkeyup="list.filter(this.value);" styleClass="myfilter"/>

<p:dataTable .... widgetVar="list">

<p:column filter="true">

But filter doesn't seems to be a valid attribute anymore (Im using yesterday nigthly build primefaces-2.0.0-SNAPSHOT.jar)

Algo tried

<p:column styleClass="myfilter">

But It didn't work either.

Does the new dataTable component supports global filter or only column scoped filters?

Thank you very much

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Feb 2010, 18:52

Hi,

1) DataTable has a new api called getPage() ;)

2) We had to global filter for now after recent filtering enhancements. But it's not permanent and will be reenabled soon.

martinezjavier
Posts: 17
Joined: 01 Feb 2010, 17:17

03 Feb 2010, 20:18

Thanks Cagatay,

In my previous post I said that I did try:

int currentPage = tablaPersonas.getPage();

But it always returns 1 no matter what page is showing the data table.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 03:12

This is strange as I use getPage with no problems. Can you try with latest snapshot, nightly builds were broken since a couple of days but they're now back live.

http://repository.prime.com.tr/org/prim ... -SNAPSHOT/

martinezjavier
Posts: 17
Joined: 01 Feb 2010, 17:17

04 Feb 2010, 15:04

I'm using the latest snapshot but having a null reference pointer exception.

Here is the stack trace:

java.lang.NullPointerException
at org.primefaces.component.datatable.DataTable.processUpdates(DataTable.java:330)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1108)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1108)
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1239)
at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

The same code is working well with previous snapshot

<p:dataTable value="#{personaListadoController.listaPersonas}"
var="persona"
rendered="#{!empty personaListadoController.listaPersonas}"
paginator="true"
paginatorTemplate="{FirstPageLink}{PreviousPageLink}{PageLinks}{NextPageLink}{LastPageLink}{RowsPerPageDropdown}"
firstPageLinkLabel="#{i18n.inicioPaginador}"
lastPageLinkLabel="#{i18n.finPaginador}"
nextPageLinkLabel="#{i18n.siguientePagina}"
previousPageLinkLabel="#{i18n.paginaAnteior}"
rows="10"
rowsPerPageTemplate="10,15,20"
widgetVar="lista"
binding="#{personaListadoController.tablaPersonas}">

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 15:14

It seems, another issue fix had a side effect on regular datatables, this will be fixed today and be available in next nightly build dated 4 feb.

martinezjavier
Posts: 17
Joined: 01 Feb 2010, 17:17

04 Feb 2010, 15:22

Thank you very much! BTW your component library is awesome

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 15:28

Thank you, we're working on it, more stuff is coming soon ;)

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Feb 2010, 02:28

This issue should be fixed now, please try with the newest nightly dating 4 feb.

martinezjavier
Posts: 17
Joined: 01 Feb 2010, 17:17

08 Feb 2010, 14:00

Yes, it working with the lastest snapshot. Thank you very much

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests