multiple selection table with polling

UI Components for JSF
Post Reply
sakal1981
Posts: 4
Joined: 25 May 2016, 00:20

04 Oct 2017, 21:34

hi everybody,

i am using a dataTable with multiple selection, that means each row has a checkbox. Additionally the dataTable is polling the db like every 2 seconds to get updates.
The issue that is occurring is that when a checkbox is selected , the selection is removed . Or other weird behavior that one checkbox is checked and going to check another one and the first one gets removed etc.
Is this behavior being caused by the polling of the db every 2 seconds? how could this be resolved?

any input would be welcoome
Thanks
sakal

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

05 Oct 2017, 15:21

Start by not using polling but push. And when an ajax 'selection' is being done while a push update is received, delay the processing of the push client-side and once the ajax selection is finished, do the update...

sakal1981
Posts: 4
Joined: 25 May 2016, 00:20

07 Oct 2017, 00:20

@kukeltje:
is there a concept in Primefaces called Push or a showcase that i could look at? And how can an ajax operation be delayed?
Additionally: does your answer mean that my assumption is correct that the selection is being influenced by the polling?

thanks
S

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

10 Oct 2017, 00:05

is there a concept in Primefaces called Push or a showcase that i could look at?
Did you check? Please do... Even using a simple searchengine would have provided this... Or the documentation...

And yes it is influenced... Not the polling but the updating after the polling (updating after push will most likely yield the same result)

sakal1981
Posts: 4
Joined: 25 May 2016, 00:20

10 Oct 2017, 19:20

yes i did check and i could not find a clear answer. Most of what i found was related to pushing messages to mobile devices. But how would i realize pushing updated table data to a simple view?

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

10 Oct 2017, 21:50

You push a 'signal' to the client in which you can initiate an update for a component. e.g. via a remoteCommand or by triggering a filter of the datatable or... But no, you cannot directly update a datatable initiated on the server. Stackoverflow has lots of related info.

And posting what you tried, searched, found etc is appreciated. Saves us 'guessing' or asking

sakal1981
Posts: 4
Joined: 25 May 2016, 00:20

16 Oct 2017, 23:52

@Kukeltje

the solution for the push and the delay when selection happening, could that not also be used for the poll? so that when there is a selection poll is being stopped clientside and continued after selection is done. Was looking at this post by Cagatay Civici:
https://cagataycivici.wordpress.com/201 ... rver-side/

what i tried so far: since my time is limited to solve this issue i did not want to make too big of code changes in the back end . So i tried things like ignoreAutoUpdate=true for poll but seems like those things do not help.

Thanks

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

17 Oct 2017, 11:56

Yes, the same 'fix' could be applied with polling...

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 44 guests