2 Replies Latest reply on Aug 20, 2014 3:15 AM by Ashwani Kalra

    rich:datascroller  How to control the pagination events

    Ashwani Kalra Newbie


      We are using rich:datascroller component for paginating the data in data table. The data table is having some editable fields.  If user has done some editing, then he should be shown warning when he tries to move away  by clicking on pagination controls like prev, next etc.  So  the next/prev events should be cancelled.


      I tried to use the onbegin of  attribute of datascroller to check the condition and cancel the event by using event.preventdefault().  There are two issues I am facing.

      1. event.preventDefault() does not work on IE. 

      2. On other browsers, it works, but after the call to event.preventDefault(), nothing happens when user again tries to click pagination controls. I am not able to rebind the event.


      if someone has implemented a solution for this, please let me know. Basically I want to control the pagination events.




        • 1. Re: rich:datascroller  How to control the pagination events
          Michal Petrov Master



          you can create your own buttons and control the datascroller through the JS API. See the showcase example.

          1 of 1 people found this helpful
          • 2. Re: rich:datascroller  How to control the pagination events
            Ashwani Kalra Newbie

            Thanks.  It was little helpful.

            There are further challenges to it. Like it is shown in the demo, I have to use my own controls.  The demo is showing page numbers at bottom, which I cannot use. It will again bypass my js calls. So I need to generate my own links for : page numbers, next, prev, having onclick  event which calls my javascript function where I can decide if user action has to be processed or not something like this

            function checkDirty() {





                                alert("Data Modified. Please save it first")





            I tried to hide page numbers which seems to be issue in richfaces 4.2.2 .   I also need to enable disable links based on which page the user is on.


            Any hints??