Loading ...
Sorry, an error occurred while loading the content.
 

How to access a changeRequest() event from YUI Paginator

Expand Messages
  • blainehilton
    I am trying to figure out how to execute a java script function when a pagination page changes occur. When someone hits next, back, first, last, or any page
    Message 1 of 3 , May 4, 2009
      I am trying to figure out how to execute a java script function when a pagination page changes occur. When someone hits next, back, first, last, or any page number I need a function to be called. I'm not sure how to work it in the code though as I'm pretty new to YUI.

      I am using the paginator with a datatable.

      I have read the documentation at http://developer.yahoo.com/yui/docs/YAHOO.widget.Paginator.html, but am unsure of exactly where to put the code.

      Thanks in advance for any pointers.
    • blainehilton
      I thought I would add some of the code I m using below. The var oConfigs has been there and working and since I believe that is where the
      Message 2 of 3 , May 4, 2009
        I thought I would add some of the code I'm using below. The var oConfigs has been there and working and since I believe that is where the YAHOO.widget.Paginator is created, right after it I put in

        YAHOO.widget.Paginator.pagechange(alert('it did it')) ; without any luck.

        Any ideas where I would put the function call in at please?






        var oConfigs = {
        paginator: new YAHOO.widget.Paginator({
        rowsPerPage: 10
        ////
        //YAHOO.widget.Paginator.pageChange(alert('it did it')) ;

        ///
        }),
        initialRequest: "client=17&match=<?php echo $match ?>"
        };

        //var test = YAHOO.widget.Paginator.pagechange(alert('it did it')) ;

        --- In ydn-javascript@yahoogroups.com, "blainehilton" <blaine@...> wrote:
        >
        > I am trying to figure out how to execute a java script function when a pagination page changes occur. When someone hits next, back, first, last, or any page number I need a function to be called. I'm not sure how to work it in the code though as I'm pretty new to YUI.
        >
        > I am using the paginator with a datatable.
        >
        > I have read the documentation at http://developer.yahoo.com/yui/docs/YAHOO.widget.Paginator.html, but am unsure of exactly where to put the code.
        >
        > Thanks in advance for any pointers.
        >
      • Lucas Smith
        ... [snip] Paginator instances host a few custom events. You can subscribe a callback function to be executed in response to these events using this syntax:
        Message 3 of 3 , May 4, 2009
          --- In ydn-javascript@yahoogroups.com, "blainehilton" <blaine@...> wrote:
          >
          > I thought I would add some of the code I'm using below. The var oConfigs has been there and working and since I believe that is where the YAHOO.widget.Paginator is created, right after it I put in
          >
          > YAHOO.widget.Paginator.pagechange(alert('it did it')) ; without any luck.
          [snip]

          Paginator instances host a few custom events. You can subscribe a callback function to be executed in response to these events using this syntax:

          var myPaginator = new YAHOO.widget.Paginator({ rowsPerPage: 10,... });
          myPaginator.subscribe('pageChange', function () {
          alert('it did it');
          });

          The changeRequest event is fired before the state of the Paginator is changed, and pageChange event is fired after the state is changed.

          Also, have a look at the docs and examples for Paginator and DataTable (or really most widgets). You'll see the pattern for event subscription used throughout YUI.

          Hope this helps,
          Luke
        Your message has been successfully submitted and would be delivered to recipients shortly.