Datatable related Issues / Feature Requests

UI Components for JSF
Post Reply
rene.guenther
Posts: 56
Joined: 19 Oct 2009, 15:56

16 Nov 2009, 10:10

Unfortunately I wasn't able to search the forum for "datatable", so maybe some of the issues / feature requests are already known and maybe even fixed in 1.0 RC. But some might be unknown. So here are the issues we found:

1. Sort by Numbers is not correct. It is sorting the numbers as if they were strings, 2 is bigger than 1 and bigger than 10

2. That one is weird: using p:column with rendered="false" in a datatable makes the whole table losing its yui-css in IE 7. I removed those p:column tags and is was working.

3. More a feature request than an issue: sorting doesnt keep state. When working on big data tables in conjunction with detail form pages the sorting is lost when returning from the detail page. Probably that applies to the paginator as well.

4. Data export only works well with outputText, if there is a commandLink the commandLink.toString (my guess) is just being called. Would be nicer if data export would look for a nested outputText within the commandLink

Cheers
René

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

16 Nov 2009, 16:17

Hi Rene,

Good thing you've pointed datatable issues, PrimeFaces 1.0.0.RC is coming out next week and datatable enhancements is the only pending task.

1) Already fixed in current trunk, for client side sorting parser config is necessary on column eg <p:column parser="date/number/string" />
2) Something to check.
3) It'll be improved as well but navigating to an other page and coming back is something that also needs to be handled by application developer since component state is view based.
4) We only consider ValueHolders so commandLink is ignored, there's a room for improvement, this will go after 1.0.0.RC release.

Thanks for the feedback Rene, hopefully these and other new features will be ready until next week.

Cagatay

Jaap
Posts: 2
Joined: 20 Nov 2009, 14:36

20 Nov 2009, 14:55

On the subject of using parsers:

I've just downloaded the 1.0.0.RC version of primefaces, because of the number sorting issue described by Rene. However I came across a problem with the sorting using parser="number". I have a column with the following definition.

Code: Select all

<p:column sortedBy="#{entry.summatedRecord.cost}" parser="number">
	<f:facet name="header">
		<h:outputText value="Kosten" />
	</f:facet>
	<h:outputText value="#{entry.summatedRecord.cost}">
		<f:converter converterId="unitConverter"/>
	</h:outputText>
</p:column>
getCost is a method which returns a long, and the unitConverter then converts this long into a monetary value with a euro sign in front of it, so the output is text. I want this to be sorted according to long value, and not according to the text value. Is there any way to do this? As using parser="number" makes the system not output anything at all. I'm using client side sorting and paging.

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

22 Nov 2009, 21:05

Jaap can you try with the 1.0.0.RC release? It has been released as of 23rd of November.

http://primefaces.prime.com.tr/en/downloads.html

Thanks.

Jaap
Posts: 2
Joined: 20 Nov 2009, 14:36

23 Nov 2009, 14:53

I've tried with the latest release and it seems the problem persists. It only happens if there's a converter attached to the value's in that column. In another column I have a standard jsf number converter, and adding a parser="number" also causes the problem

Code: Select all

<p:column sortedBy="#{entry.summatedRecord.averagePosition}" parser="number">
	<f:facet name="header">
		<h:outputText value="Gemiddelde positie" />
	</f:facet>
	<h:outputText rendered="#{!entry.negatief}" value="#{entry.summatedRecord.averagePosition}">
		<f:convertNumber maxFractionDigits="2" minFractionDigits="2" maxIntegerDigits="2"/>
	</h:outputText>
</p:column>

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

24 Nov 2009, 15:30

I see, built-in client side parsers are string, date and number. I think you need to define a custom client side sort function to implement this since curreny sorting is kind of a custom sort.

Please see this page;

http://developer.yahoo.com/yui/datatable/#advancedsort

I can add a sortFunction attribute to our p:column then, you can plugin your own client side sort function. I can help you with the implementation of that function. How does it sound?

Also with dynamic table (ajax), sorting could work out of the box. You need dynamic="true" setting on p:dataTable for this.

Inah
Posts: 31
Joined: 18 Nov 2009, 00:01
Location: Brazil

27 Nov 2009, 19:13

Hi Cagatay!

I'm building a dataTable with h:commandLink inside a p:column but when I try to sort the column, it doesn't work...I tryed to put parser attributte but it make any difference...
When I put the tag dynamic="true" my dataTable stops working at all....

Code: Select all

<p:dataTable rows="50" value="#{campaignBean.campaigns}"
							paginator="true" var="campaign" emptyMessage="Nao ha registros"
							scrollable="true" width="100%" height="250px"
							paginatorTemplate="{FirstPageLink}{PreviousPageLink}{PageLinks}{NextPageLink}{LastPageLink}"
							rowsPerPageTemplate="50,100,200">
<p:column sortBy="#{cpg.campaign}">
								<f:facet name="header">
									<h:outputText value="#{cpg.campaign}" />
								</f:facet>
								<h:commandLink rel="loading" id="commandCampaign"
									action="#{campaignBean.listAdGroups}" value="#{campaign.name}">
									<f:param name="campaignID" value="#{campaign.id}" />
								</h:commandLink>
							</p:column>

Could anyone help me, please?

TKS!
Inah from Brazil

onyii5119
Posts: 112
Joined: 25 Nov 2009, 00:22

27 Nov 2009, 23:34

sortBy="#{cpg.campaign}"

<p:dataTable rows="50" value="#{campaignBean.campaigns}"
paginator="true" var="campaign" emptyMessage="Nao ha registros"

What is cpg?

sortBy="#{cpg.campaign}" should be sortBy="#{campaign.campaign}".
Jonathan Ekwempu
TobiSoft Inc.

Inah
Posts: 31
Joined: 18 Nov 2009, 00:01
Location: Brazil

30 Nov 2009, 17:31

Hi onyii5119 !
TKS for answer but i tried sortBy="#{campaign.campaign}" and didn't work too...
CPG is a var to a loadbundle with a properties file, to internationalize everything I write in my app automatically to any language.

Code: Select all

<f:loadBundle basename="br.com.webtraffic.bid.i18n.listCampaign" var="cpg" />

I dont know why my sorting is no working, is strange because all others columns it works!Only in this one....I think is because I have a commandLink inside perhaps.....

Sorry my bad english...if Im no beein clear, just ask and I will try to specify better...

If anyone still know how to help me, please feel free!!!hehehe

TKS!!
Inah from Brazil

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

02 Dec 2009, 17:04

Sort by has to be a property of your datamodel pojo like sortedBy="#{campaign.name}".

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 48 guests