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

Knowing when the datatable is fully loaded

Expand Messages
  • andrewrjones86
    Does anyone know how to find out if the datatable is loaded before executing some code? I would have thought the tableInitEvent would, but this never seems to
    Message 1 of 8 , May 17, 2007
    • 0 Attachment
      Does anyone know how to find out if the datatable is loaded before
      executing some code?

      I would have thought the tableInitEvent would, but this never seems to
      get fired.

      Thanks for your help.
      Andrew
    • Nick Fitzsimons
      ... Am I right to assume that when you say the datatable is loaded you mean the datatable is first fully populated with data ? The tableInitEvent appears to
      Message 2 of 8 , May 17, 2007
      • 0 Attachment
        On 17 May 2007, at 13:05:20, andrewrjones86 wrote:

        > Does anyone know how to find out if the datatable is loaded before
        > executing some code?
        >
        > I would have thought the tableInitEvent would, but this never seems to
        > get fired.
        >
        > Thanks for your help.
        > Andrew

        Am I right to assume that when you say "the datatable is loaded" you
        mean "the datatable is first fully populated with data"?

        The tableInitEvent appears to be fired when the table instance is
        created and initialised, not when the data is first inserted. I
        haven't really worked with the datatable class, but a quick dig
        through the code leads me to believe that the rowReplaceEvent may be
        what you want - it is fired from the replaceRows method, which seems
        to do all of the donkey work; it is _not_ fired if there are no
        records to display.

        If you only want to do something special when the table is first
        populated with data, but not on subsequent changes such as
        pagination, then you can subscribe to the rowReplaceEvent, and your
        event handler can then unsubscribe itself (although you should watch
        out for bug #1708014 in that case [1]).

        [1] <http://sourceforge.net/tracker/index.php?
        func=detail&aid=1708014&group_id=165715&atid=836476>

        HTH,

        Nick.
        --
        Nick Fitzsimons
        http://www.nickfitz.co.uk/
      • andrewrjones86
        Thanks for you help. I am having trouble subscribing to this event. Am I right in just doing the following? myDataTable.subscribe( rowReplaceEvent ,foo);
        Message 3 of 8 , May 17, 2007
        • 0 Attachment
          Thanks for you help. I am having trouble subscribing to this event. Am
          I right in just doing the following?

          myDataTable.subscribe("rowReplaceEvent",foo);

          Thanks,
          Andrew

          --- In ydn-javascript@yahoogroups.com, Nick Fitzsimons <nick@...> wrote:
          >
          > On 17 May 2007, at 13:05:20, andrewrjones86 wrote:
          >
          > > Does anyone know how to find out if the datatable is loaded before
          > > executing some code?
          > >
          > > I would have thought the tableInitEvent would, but this never seems to
          > > get fired.
          > >
          > > Thanks for your help.
          > > Andrew
          >
          > Am I right to assume that when you say "the datatable is loaded" you
          > mean "the datatable is first fully populated with data"?
          >
          > The tableInitEvent appears to be fired when the table instance is
          > created and initialised, not when the data is first inserted. I
          > haven't really worked with the datatable class, but a quick dig
          > through the code leads me to believe that the rowReplaceEvent may be
          > what you want - it is fired from the replaceRows method, which seems
          > to do all of the donkey work; it is _not_ fired if there are no
          > records to display.
          >
          > If you only want to do something special when the table is first
          > populated with data, but not on subsequent changes such as
          > pagination, then you can subscribe to the rowReplaceEvent, and your
          > event handler can then unsubscribe itself (although you should watch
          > out for bug #1708014 in that case [1]).
          >
          > [1] <http://sourceforge.net/tracker/index.php?
          > func=detail&aid=1708014&group_id=165715&atid=836476>
          >
          > HTH,
          >
          > Nick.
          > --
          > Nick Fitzsimons
          > http://www.nickfitz.co.uk/
          >
        • Satyam
          There is no clear event signaling when the table is fully loaded, the rowReplaceEvent being fired as close to the end of the process as it gets, but also gets
          Message 4 of 8 , May 17, 2007
          • 0 Attachment
            There is no clear event signaling when the table is fully loaded, the
            rowReplaceEvent being fired as close to the end of the process as it gets,
            but also gets fired under other circumstances.

            Perhaps someone would like to put his name in a feature request?

            Satyam

            ----- Original Message -----
            From: "Nick Fitzsimons" <nick@...>
            To: <ydn-javascript@yahoogroups.com>
            Sent: Thursday, May 17, 2007 2:45 PM
            Subject: Re: [ydn-javascript] Knowing when the datatable is fully loaded


            > On 17 May 2007, at 13:05:20, andrewrjones86 wrote:
            >
            >> Does anyone know how to find out if the datatable is loaded before
            >> executing some code?
            >>
            >> I would have thought the tableInitEvent would, but this never seems to
            >> get fired.
            >>
            >> Thanks for your help.
            >> Andrew
            >
            > Am I right to assume that when you say "the datatable is loaded" you
            > mean "the datatable is first fully populated with data"?
            >
            > The tableInitEvent appears to be fired when the table instance is
            > created and initialised, not when the data is first inserted. I
            > haven't really worked with the datatable class, but a quick dig
            > through the code leads me to believe that the rowReplaceEvent may be
            > what you want - it is fired from the replaceRows method, which seems
            > to do all of the donkey work; it is _not_ fired if there are no
            > records to display.
            >
            > If you only want to do something special when the table is first
            > populated with data, but not on subsequent changes such as
            > pagination, then you can subscribe to the rowReplaceEvent, and your
            > event handler can then unsubscribe itself (although you should watch
            > out for bug #1708014 in that case [1]).
            >
            > [1] <http://sourceforge.net/tracker/index.php?
            > func=detail&aid=1708014&group_id=165715&atid=836476>
            >
            > HTH,
            >
            > Nick.
            > --
            > Nick Fitzsimons
            > http://www.nickfitz.co.uk/
            >
            >
            >
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            > --
            > No virus found in this incoming message.
            > Checked by AVG Free Edition.
            > Version: 7.5.467 / Virus Database: 269.7.1/807 - Release Date: 16/05/2007
            > 18:05
            >
          • Nick Fitzsimons
            ... It looks to me like that should work, assuming foo is a function. As I said, I m not really up to speed on the datatable class (I just read through the
            Message 5 of 8 , May 17, 2007
            • 0 Attachment
              On 17 May 2007, at 14:38:29, andrewrjones86 wrote:

              > Thanks for you help. I am having trouble subscribing to this event. Am
              > I right in just doing the following?
              >
              > myDataTable.subscribe("rowReplaceEvent",foo);
              >
              > Thanks,
              > Andrew

              It looks to me like that should work, assuming foo is a function. As
              I said, I'm not really up to speed on the datatable class (I just
              read through the code) and haven't done an enormous amount with the
              EventProvider class either, so I'm not sure why that wouldn't work.

              Maybe somebody else here can point to a working example?

              Regards,

              Nick.
              --
              Nick Fitzsimons
              http://www.nickfitz.co.uk/
            • andresm1981
              ... Related to your question and the tableInitEvent never firing, it might be related to the fact that this event is fired in the constructor, so in theory you
              Message 6 of 8 , May 17, 2007
              • 0 Attachment
                --- In ydn-javascript@yahoogroups.com, "andrewrjones86"
                <andrewjones86@...> wrote:
                >
                >
                > Does anyone know how to find out if the datatable is loaded before
                > executing some code?
                >
                > I would have thought the tableInitEvent would, but this never seems to
                > get fired.
                >
                > Thanks for your help.
                > Andrew
                >

                Related to your question and the tableInitEvent never firing, it might
                be related to the fact that this event is fired in the constructor, so
                in theory you cannot listen to an event of an object that does not
                exist yet =)

                I found a workaround to listen to this event, but it involves
                subclassing datatable and subscribing to the Tableinit event in the
                subclass constructor.

                See the post below:
                http://tech.groups.yahoo.com/group/ydn-javascript/message/11838
              • Makoki
                ... I know this post is old and perhaps there s no need no reply, but I do it. Recently I ve got trouble like this, and got a solution that worked fine for me.
                Message 7 of 8 , Jun 1, 2007
                • 0 Attachment
                  --- In ydn-javascript@yahoogroups.com, "andrewrjones86"
                  <andrewjones86@...> wrote:
                  >
                  >
                  > Does anyone know how to find out if the datatable is loaded before
                  > executing some code?
                  >
                  > I would have thought the tableInitEvent would, but this never seems to
                  > get fired.
                  >
                  > Thanks for your help.
                  > Andrew
                  >

                  I know this post is old and perhaps there's no need no reply, but I do
                  it. Recently I've got trouble like this, and got a solution that
                  worked fine for me.

                  ' Subscribe dataReturnEvent
                  myDataTable.subscribe('dataReturnEvent',hdlRetornoDatos);

                  var hdlRetornoDatos=function(oArgs)
                  { // prevent there's no empty response
                  if(oArgs.response!='')
                  { // display de value of some field of the first record
                  alert(oArgs.response.length); alert(oArgs.response[0].NameOfField1);
                  // display the value of the last record
                  alert(oArgs.response[oArgs.response.length-1].NameOfField1);
                  }
                  };

                  Hope this help someone.

                  Regards,

                  Ferran.
                • Satyam
                  The initEvent signals when the DataTable is fully drawn.
                  Message 8 of 8 , Dec 2, 2008
                  • 0 Attachment
                    The initEvent signals when the DataTable is fully drawn.

                    jeniferlopez43 wrote:
                    > http://google.com
                    >
                    >
                    > ------------------------------------
                    >
                    > Yahoo! Groups Links
                    >
                    >
                    >
                    > ------------------------------------------------------------------------
                    >
                    >
                    > No virus found in this incoming message.
                    > Checked by AVG - http://www.avg.com
                    > Version: 8.0.176 / Virus Database: 270.9.12/1822 - Release Date: 01/12/2008 8:23
                    >
                    >
                  Your message has been successfully submitted and would be delivered to recipients shortly.