Visual Indicator in Primefaces Datatable Sortable Column.

UI Components for JSF
saurabh
Posts: 10
Joined: 22 Nov 2011, 09:52

22 Nov 2011, 19:18

HI All,

I am using Jsf 2.0 and Primefaces 3.0.

I want to add Visual indicator in datatable sortable column. All columns are sortable in datatable. Visual indicator mean different style to the column which is sorting the datatable.

Please advice.

Regards,
Saurabh Bansal
Last edited by saurabh on 23 Nov 2011, 09:47, edited 1 time in total.

saurabh
Posts: 10
Joined: 22 Nov 2011, 09:52

23 Nov 2011, 16:22

Is there any inbuild function ?

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

23 Nov 2011, 18:23

If you setup the facet header column for sorting as demonstrated in the showcase then the markers will appear automatically.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

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

23 Nov 2011, 18:46

Don't understand your case, datatable displays sort arrow icons and applies ui-state-active to the sorted column header already.

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

23 Nov 2011, 20:02

I think he wants to have all the cells of the sorted column to be highlighted.

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

23 Nov 2011, 20:16

Oh ok, there is nothing built-in for that and probably won't be.

saurabh
Posts: 10
Joined: 22 Nov 2011, 09:52

24 Nov 2011, 18:43

Hi all,

Thanks for the response.

There is inbuild function for visual indicator in datatable header but when datatable loads for the first time then there is no visual indicator for the column which is sorting the table by default. I need to add visual indicator for this default column.

Please advice.

Regards,
Saurabh Bansal

baspet
Posts: 37
Joined: 18 Jan 2011, 14:53

25 Nov 2011, 00:46

hi,

try this:
<p:datatable sortBy="col2" ...>
<p:column sortBy="col1" ... />
<p:column sortBy="col2" ... />
<p:column sortBy="col3" ... />
<p:datatable>

saurabh
Posts: 10
Joined: 22 Nov 2011, 09:52

25 Nov 2011, 10:04

Its not working :(

baspet
Posts: 37
Joined: 18 Jan 2011, 14:53

25 Nov 2011, 11:59

Hi,

that's strange!!! I am using many datatables without problem. Please, use #{col2} instead of col2. I am highlighting lazy attribue, in case primefaces use sortBy only for that mode.

my code:

<p:dataTable id="tblGaming" var="instance" value="#{gamingAction.model}"
paginator="true"
rows="10"
dynamic="true"
styleClass="blue"
lazy="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink}
{PreviousPageLink} {PageLinks} {NextPageLink}
{LastPageLink} {RowsPerPageDropdown}"
paginatorPosition="bottom"
rowsPerPageTemplate="10,20,50"
sortBy="#{cpndate}"
sortOrder="descending"
>
<p:column headerText="#{i18n['gamingTrns.channel']}" sortBy="#{channel_id}">
...
</p:column>
<p:column style="text-align:right;" headerText="#{i18n['gamingTrns.date']}" sortBy="#{cpndate}">
...
</p:column>
.......

Primefaces 3.0.RC1-SNAPSHOT, liferay 6.0.5
Vassilis

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 60 guests