aspose file tools*
The moose likes JSF and the fly likes Problem in sorting data in Richface DataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem in sorting data in Richface DataTable" Watch "Problem in sorting data in Richface DataTable" New topic
Author

Problem in sorting data in Richface DataTable

Jayesh Mahato
Greenhorn

Joined: Jun 24, 2011
Posts: 17
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.
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
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?
Dieter Quickfend
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
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.


Oracle Certified Professional: Java SE 6 Programmer
Oracle Certified Expert: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans Developer
Jayesh Mahato
Greenhorn

Joined: Jun 24, 2011
Posts: 17
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
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
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

Joined: Jun 24, 2011
Posts: 17
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??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in sorting data in Richface DataTable
 
Similar Threads
Edit or delete records resulting from search
problem on saving inputText values
Problem in displaying data in Richface DataTable
show "hourglass" during datatable sort
Richfaces Scrollable Datatable with filtermethod not working