• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in sorting data in Richface DataTable

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Richfaces 4 Final in JBoss Dev Studio 4 GA using JBoss 6 server. I am stucked with sorting in datatable. I am using this xhtml page:

i am using arraylist to store some data in a bean Alist:

The sorting class defined by me is:

The moment i click in the sort header, nothing happens except that the URL is appended by a # sign. Kindly help me...

Edit Note: In IE, I am getting a warning error on bottom-left of the browser which on clicking displays 'RichFaces' is undefined. Its a warning error though.
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not familiar with richfaces but it seems that you are following somekind of example. Can you show this example to us?

Also, where do you define that your class (called "sorting") is used?
 
Bartender
Posts: 543
4
Netbeans IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even though it is possible to sort in a normal rich:dataTable because the graphical model supports it, the component actually does not support sorting out of the box. They just support it graphically so you can implement your own. We've had the same problem, it does work in Firefox and IE8 (IIRC) somehow, but it screws up in pretty much all the other browsers. This is 3.3.3 though, so if they've changed it in 4, disregard my words, otherwise, there's no need to even attempt it.

What you need is extendedDataTable, if you want sorting.

Your header should also not be a commandlink. That's not how you sort a column. Just an outputlabel.

check some examples on the richfaces site.

Also, you should REALLY follow your naming conventions. Not doing so leads to all kinds of confusion, and difficult to track bugs.
 
Jayesh Mahato
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Facing same issue in ExtendedDataTable. I have used the commandLink for sorting as it was provided in the Richfaces website itself: RichFaces Showcase: DataTable

Anyhow can you provide me a working example for the case? Thanks for the reply though
 
Dieter Quickfend
Bartender
Posts: 543
4
Netbeans IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, I think I get it now. You're implementing your own sorting.

Well, first thing I'd do if I were you is follow naming conventions. You class name starts with no capital but your variable EL variables do. You might just have a capitalization problem there. Your class is called Alist and your managed bean is called AList, for instance. do you declare them as such in your faces-config?
 
Jayesh Mahato
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Yes faces-config has the corresponding entry. I don't know how but today the project started showing the data, with the same code.
Then again it went blank. I created a new project and then ran it then also it didn't run. But now again its running... Phew...

I have replace the command link and using command button. But the sorting takes place only once once, the first time I hit the button. Thereafter the sorting doesn't take place, but it should be sorted either way as written in the code. And yes it runs on google chrome too.

Why is this working only the first time??
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic