-
1. Re: How to stop request with javascript in rich:datascroller RF4?
merlincaf Oct 31, 2014 9:39 AM (in response to merlincaf)Do nobody know a solution to the problem?
Thanks
-
2. Re: Re: How to stop request with javascript in rich:datascroller RF4?
bluez974 Oct 31, 2014 12:08 PM (in response to merlincaf)Hello, you could overload the javascript functions of the component described here : Component Reference
<rich:dataScroller id="dtScroller" page="#{bean.pager}" for="tableId" oncomplete="rewriteScrollerFunction(#{rich:component('dtScroller')})"/> <h:outputScript> jQuery(document).ready(function() { rewriteScrollerFunction(#{rich:component('dtScroller')}); }); function rewriteScrollerFunction(scroller) { scroller.switchToPageBase = scroller.switchToPage; scroller.switchToPage = function(pageIndex) { if (confirm('GO ?')) { return this.switchToPageBase(pageIndex); } } } </h:outputScript>
-
3. Re: How to stop request with javascript in rich:datascroller RF4?
merlincaf Oct 31, 2014 3:03 PM (in response to bluez974)Thanks, this solution is great, but
- I click OK and I switch to another page
- in this page I click on dataScroller
- I click OK to switch to another page but I see multiple confirm window and the datascroller not switch
This solution works fine only in the first time, why?
My datascroller is in the footer of the dataTable and the dataTable is render by datascroller:
... <f:facet name="footer"> <rich:dataScroller id="myDataScroller" for="tableMemberships" maxPages="5" fastControls="hide" scrollListener="#{usersBean.pageListener}" render="@form" page="#{usersBean.currentPage2}" status="loadStatus" oncomplete="rewriteScrollerFunction(#{rich:component('myDataScroller')})" title="#{label['title.paginator.cert.alert']}"> </rich:dataScroller> <h:outputScript > jQuery(document).ready(function() { rewriteScrollerFunction(#{rich:component('myDataScroller')}); }); function rewriteScrollerFunction(scroller) { scroller.switchToPageBase = scroller.switchToPage; scroller.switchToPage = function(pageIndex) { if (confirm('GO ?')) { return this.switchToPageBase(pageIndex); } } } </h:outputScript> </f:facet> </rich:dataTable>
-
4. Re: Re: How to stop request with javascript in rich:datascroller RF4?
bluez974 Oct 31, 2014 1:44 PM (in response to merlincaf)1 of 1 people found this helpfulI think it's because you specify to render the form in your scroller. So the rewriteScrollFunction is called twice :
the first time through the jquery(document).ready which is called when the form is reRenred
the second time in the oncomplete of the element
you can try to remove the oncomplete of the dataScroller and keep the render="@form"
or to put the outputScript outside the form so that it is just called on the first load of the page
have a good we
-
5. Re: Re: How to stop request with javascript in rich:datascroller RF4?
merlincaf Oct 31, 2014 3:00 PM (in response to bluez974)removing the onComplete everything works fine.
Thank you so much, you were very helpful!