Can livescroll be used for dynamic datatable?

UI Components for JSF
Post Reply
jsaliga
Posts: 4
Joined: 08 Dec 2014, 18:14

08 Dec 2014, 18:57

Can livescroll be used for dynamic datatable? If so, how for instance would you refresh the datatable data when the existing info becomes stale? Seems as though with livescrolling on the js ajax callback always just appends to the end of the current table data.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

09 Dec 2014, 14:37

jsaliga wrote:Can livescroll be used for dynamic datatable?
Yes
jsaliga wrote:If so, how for instance would you refresh the datatable data when the existing info becomes stale
Catch-22? The only basic way you yourself would know is to query all data again...

Second more complex option is to have some pub-sub mechanism where when updating a row from somewhere else, you get a notification and use that to do what? A full refresh and update the full table? Or try to update the individual row?
jsaliga wrote:Seems as though with livescrolling on the js ajax callback always just appends to the end of the current table data.
Correct

I personally would just check with e.g. a version number if it is updated at the moment the record is actually opened

jsaliga
Posts: 4
Joined: 08 Dec 2014, 18:14

09 Dec 2014, 16:23

Thanks for the reply Ronald.

I'm still not clear on how I can force the livescroll datatable to dump all existing table data and essentially start from scratch with a new record set from a fresh db query. I'm hoping to avoid a complex solution for such a simple refresh.

Example:

Query the DB for a list of types of "Cats". I have livescroll="true" and scrollRows="15". The query returns 100 types of cats. If I requery using the same query. The original 100 cat types remains in the list and the exact same list is duplicated again.

Is the original query being cached or something?

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

09 Dec 2014, 16:48

Use lazy loading... much more control over the dataset.

jsaliga
Posts: 4
Joined: 08 Dec 2014, 18:14

09 Dec 2014, 19:07

Seems like overkill for what I need though.. What I am trying to understand is...

What would cause the list to refresh as expected when performing a different query but retain a cache and duplicate the records when performing the same query?

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

09 Dec 2014, 19:52

No idea... could be that you just add them... not reset the 'first' and/or page, using an old version of pf...

jsaliga
Posts: 4
Joined: 08 Dec 2014, 18:14

11 Dec 2014, 17:33

We're PrimeFaces elite subscribers on the almost latest 5.1.5 build. I'm not using any form of pagination. I simply have a list of objects that the backing bean provides via the get function. Everything works perfectly fine until I turn livescroll on. The reason why we want to use livescroll is because we need to support IE8 and a DB query could yield thousands of results. The client does not want pagination so unfortunately that's not an option.

I've scoured through the primefaces source code on github (https://github.com/primefaces/primefaces) in order to understand why the livescroll datatable ajax update of the dataset with the same dataset would result in duplication when scrolling yet when updating with a different dataset it does not, without success...

If anyone has any ideas on what might be going wrong please advise. I'm not doing anything complex here and I shouldn't have to change my solution to a complex one to avoid duplicating table rows when ajax sends back the same row data.

I've logged an issue in the meantime as I'm fairly confident that this is a bug unless someone can prove me wrong. https://code.google.com/p/primefaces/is ... il?id=7752

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests