File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Filtering in the primefaces datatable having large dataset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Filtering in the primefaces datatable having large dataset" Watch "Filtering in the primefaces datatable having large dataset" New topic
Author

Filtering in the primefaces datatable having large dataset

Raghu Sundar
Ranch Hand

Joined: Aug 01, 2013
Posts: 40

I have a table with more than 4000 records for which i need to implement datatable.I also need to provide filtering for this datatable similar to the one shown in showcase and it needs to be applied to all the records. Datatable shouldn't have pagination.Which is the best way to implement this,do i need to go with live scrolling or lazy loading.The main thing is i need to do filtering on all the records.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

If at any time you display anything near 4000 records on a single webpage you will not only experience serious performance issues (it can take a LONG time to assemble and ship that large a page), you may blow out the client's browser, and the users will end up with bleeding eyeballs to boot.

Unless you can absolutely guarantee that no more than about 100 records will be displayed at any time, you should seriously reconsider using some sort of pagination. And if you have idiot management that forbids it, you should use the time otherwise spent coding to update your CV, because if they're that incompetent, things can only get worse and you are well-advised to seek employment in a shop where sanity is more common.

You can assemble a datatable which acts as a window on a large array by constructing a UI model object. For example, an array or List which contains only the details of interest. You can do this in Java because an array or List doesn't "own" its contents, it merely references them. So two different arrays or Lists (or mix of the 2) can both reference the same detail row object.


Customer surveys are for companies who didn't pay proper attention to begin with.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

Rakshith Sridharamurthy wrote:Datatable shouldn't have pagination

Is that an actual requirement? Even if each row contains a small amount of data (so an impact on performance was negligible), are the users prepared to scroll down the page forever?

Also, instead of filtering on the entire 4000 records, would it not be wiser to implement a search facility? Imagine a user coming along and having to wait for all 4000 records to load before filtering to find a single record. Doesn't sound very user-friendly to me.
Raghu Sundar
Ranch Hand

Joined: Aug 01, 2013
Posts: 40

Thank you for giving your thoughts on this.The requirement of the client is the entire table containing about 4000 records must be searched on a specific column.I want to ask if we can get this kind of functionality using pagination or live scrolling or any other way.This functionality is very important.Please give suggestion how i can do this.
Thanks in advance.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

Yes you can. Although it's possible even with basic core JSF to get this kind of behavior by brute force, many of the extension tag sets such as RichFaces have extensive capabilities in this regard.

As far as I know, Primefaces does also.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

Rakshith Sridharamurthy wrote:
I also need to provide filtering for this datatable similar to the one shown in showcase and it needs to be applied to all the records

I assume you are talking about this:
Datatable Filtering

This looks like it will meet you requirements, what functionality does it not provide for you?
Raghu Sundar
Ranch Hand

Joined: Aug 01, 2013
Posts: 40

That is even if i am present at initial records i should be able to search the records present in ending rows based on a search criteria.Is that possible using primefaces?Using Datatable filtering(with pagination or live scrolling)
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

I believe that the filtering works solely on the content of the datatable. As long as you place the results of your search in the datatable, the filtering controls will do the rest.
Raghu Sundar
Ranch Hand

Joined: Aug 01, 2013
Posts: 40

Thanks Tim and James for providing valuable suggestion.I will try to implement this using primefaces datatable filtering.
One last question the primefaces datatable which i am going to have is a cell editable with multiple selection,is datatable filtering with lazy loading possible with this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filtering in the primefaces datatable having large dataset