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

Subscribing to renderEvent in DataTable.

Expand Messages
  • Shishir Jain
    Hello: I need to subscribe to renderEvent on Datatable instance. This is how I m registering it: myDatatable.subscribe( renderEvent , function() {
    Message 1 of 7 , May 2, 2008
    • 0 Attachment
      Hello:

      I need to subscribe to renderEvent on Datatable instance. This is how I'm registering it:

      myDatatable.subscribe("renderEvent", function()
                             { alert('renderEvent Called");
      });

      But this does not getting called.

      If I do the same with "initEvent" it gets called.

      What is more baffling is that when I register like:

      myDatatable.subscribe("renderEvent", alert("renderEvent Called"));

      it gets called.

      Unable to understand what is happening. Any ideas what is the correct way to register for renderEvent on datatable?

      Thanks & Regards,
      Shishir Jain.
    • Satyam
      I can do all of them, subscribe to renderEvent, to initEvent and in renderEvent putting a statement instead of a function, it all works for me. Actually, the
      Message 2 of 7 , May 2, 2008
      • 0 Attachment
        I can do all of them, subscribe to renderEvent, to initEvent and in renderEvent putting a statement instead of a function, it all works for me.  Actually, the last one does give me an error, but after the alert is called.  I believe this is a bug because the event.js does verify the callback function is a callback function, but does that after the listener was actually set, or so it seems (events, being asynchronous are somewhat hard to step through).  So, you might have discovered a bug in Event.js.  Which is not what you are concerned about right now so, is there somewhere we can see your code in action?  As I said, it works for me.
         
        Satyam
         
        ----- Original Message -----
        Sent: Friday, May 02, 2008 1:47 PM
        Subject: [ydn-javascript] Subscribing to renderEvent in DataTable.

        Hello:

        I need to subscribe to renderEvent on Datatable instance. This is how I'm registering it:

        myDatatable.subscribe("renderEvent", function()
                               { alert('renderEvent Called");
        });

        But this does not getting called.

        If I do the same with "initEvent" it gets called.

        What is more baffling is that when I register like:

        myDatatable.subscribe("renderEvent", alert("renderEvent Called"));

        it gets called.

        Unable to understand what is happening. Any ideas what is the correct way to register for renderEvent on datatable?

        Thanks & Regards,
        Shishir Jain.


        No virus found in this incoming message.
        Checked by AVG.
        Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date: 01/05/2008 17:30
      • traderashish
        I am also having the issue with renderEvent not firing. If I subscribe to rowClickEvent and click on a row the following code works but not for renderEvent. I
        Message 3 of 7 , May 2, 2008
        • 0 Attachment
          I am also having the issue with renderEvent not firing.

          If I subscribe to rowClickEvent and click on a row the following code
          works but not for renderEvent.

          I am getting data from external source as JSON.

          Ashish

          code...( I took out some unrelated lines from original code for
          clarity like a checkbox column and some more data columns)

          YAHOO.util.Event.onDOMReady(function () {

          var Ev = YAHOO.util.Event,
          Dom = YAHOO.util.Dom,
          DS = YAHOO.util.DataSource,
          Ex = YAHOO.namespace('pmc'),
          DT = YAHOO.widget.DataTable,
          markRecs = {},
          data = [],
          i = 0;


          // Create a custom function to store the records needing row
          coloring
          YAHOO.widget.DataTable.Formatter.mark = function
          (cell,rec,col,data) {
          if (data == "Closed") {
          // In object hash to prevent duplication
          markRecs[rec.getId()] = rec;
          for (var recKey in markRecs) {
          alert("marks" + recKey +markRecs[recKey]);
          }
          }
          cell.innerHTML = data;
          };


          var myColumnDefs = [
          {key:"id", label:"Case Id", sortable:true},
          {key:"status",
          label:"Status",formatter:"mark",sortable:true},
          ];

          Ex.myDataSource = new
          YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
          Ex.myDataSource.responseType =
          YAHOO.util.DataSource.TYPE_JSON;

          // When responseSchema.totalRecords is not
          indicated, the records
          // returned from the DataSource are assumed to
          represent the entire set
          Ex.myDataSource.responseSchema = {
          resultsList: "items",
          fields: [{key:"id","status"]};


          // Function to add the color class to rows
          Ex.updateMarks = function () {
          alert("in update marks");

          // Clear mark class off all rows
          Dom.removeClass(
          Dom.getElementsByClassName('mark','tr',
          Ex.myDataTable.getTbodyEl()),
          'mark');

          // Apply mark class to identified rows
          for (var recKey in markRecs) {

          Dom.addClass(Ex.myDataTable.getTrEl(markRecs[recKey]),'mark');
          }
          };


          Ex.myDataTable = new
          YAHOO.widget.DataTable("sort", myColumnDefs,
          Ex.myDataSource);
          Ex.updateMarks();
          Ex.myDataTable.subscribe('renderEvent',
          Ex.updateMarks);
          Ex.myDataTable.subscribe('rowClickEvent',
          Ex.updateMarks);


          });





          --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
          >
          > I can do all of them, subscribe to renderEvent, to initEvent and in
          renderEvent putting a statement instead of a function, it all works
          for me. Actually, the last one does give me an error, but after the
          alert is called. I believe this is a bug because the event.js does
          verify the callback function is a callback function, but does that
          after the listener was actually set, or so it seems (events, being
          asynchronous are somewhat hard to step through). So, you might have
          discovered a bug in Event.js. Which is not what you are concerned
          about right now so, is there somewhere we can see your code in action?
          As I said, it works for me.
          >
          > Satyam
          >
          > ----- Original Message -----
          > From: Shishir Jain
          > To: ydn-javascript@yahoogroups.com
          > Sent: Friday, May 02, 2008 1:47 PM
          > Subject: [ydn-javascript] Subscribing to renderEvent in DataTable.
          >
          >
          > Hello:
          >
          > I need to subscribe to renderEvent on Datatable instance. This is
          how I'm registering it:
          >
          > myDatatable.subscribe("renderEvent", function()
          > { alert('renderEvent Called");
          > });
          >
          > But this does not getting called.
          >
          > If I do the same with "initEvent" it gets called.
          >
          > What is more baffling is that when I register like:
          >
          > myDatatable.subscribe("renderEvent", alert("renderEvent Called"));
          >
          > it gets called.
          >
          > Unable to understand what is happening. Any ideas what is the
          correct way to register for renderEvent on datatable?
          >
          > Thanks & Regards,
          > Shishir Jain.
          >
          >
          >
          >
          ------------------------------------------------------------------------------
          >
          >
          > No virus found in this incoming message.
          > Checked by AVG.
          > Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
          01/05/2008 17:30
          >
        • traderashish
          For me initEvent worked. renderEvent did not work. So I am using initEvent. thanks to Luke for helping out. I am using remote/external data source. Thanks
          Message 4 of 7 , May 2, 2008
          • 0 Attachment
            For me initEvent worked. renderEvent did not work. So I am using
            initEvent. thanks to Luke for helping out.

            I am using remote/external data source.

            Thanks
            Ashish

            --- In ydn-javascript@yahoogroups.com, "traderashish"
            <traderashish@...> wrote:
            >
            >
            > I am also having the issue with renderEvent not firing.
            >
            > If I subscribe to rowClickEvent and click on a row the following code
            > works but not for renderEvent.
            >
            > I am getting data from external source as JSON.
            >
            > Ashish
            >
            > code...( I took out some unrelated lines from original code for
            > clarity like a checkbox column and some more data columns)
            >
            > YAHOO.util.Event.onDOMReady(function () {
            >
            > var Ev = YAHOO.util.Event,
            > Dom = YAHOO.util.Dom,
            > DS = YAHOO.util.DataSource,
            > Ex = YAHOO.namespace('pmc'),
            > DT = YAHOO.widget.DataTable,
            > markRecs = {},
            > data = [],
            > i = 0;
            >
            >
            > // Create a custom function to store the records needing row
            > coloring
            > YAHOO.widget.DataTable.Formatter.mark = function
            > (cell,rec,col,data) {
            > if (data == "Closed") {
            > // In object hash to prevent duplication
            > markRecs[rec.getId()] = rec;
            > for (var recKey in markRecs) {
            > alert("marks" + recKey +markRecs[recKey]);
            > }
            > }
            > cell.innerHTML = data;
            > };
            >
            >
            > var myColumnDefs = [
            > {key:"id", label:"Case Id", sortable:true},
            > {key:"status",
            > label:"Status",formatter:"mark",sortable:true},
            > ];
            >
            > Ex.myDataSource = new
            > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
            > Ex.myDataSource.responseType =
            > YAHOO.util.DataSource.TYPE_JSON;
            >
            > // When responseSchema.totalRecords is not
            > indicated, the records
            > // returned from the DataSource are assumed to
            > represent the entire set
            > Ex.myDataSource.responseSchema = {
            > resultsList: "items",
            > fields: [{key:"id","status"]};
            >
            >
            > // Function to add the color class to rows
            > Ex.updateMarks = function () {
            > alert("in update marks");
            >
            > // Clear mark class off all rows
            > Dom.removeClass(
            > Dom.getElementsByClassName('mark','tr',
            > Ex.myDataTable.getTbodyEl()),
            > 'mark');
            >
            > // Apply mark class to identified rows
            > for (var recKey in markRecs) {
            >
            > Dom.addClass(Ex.myDataTable.getTrEl(markRecs[recKey]),'mark');
            > }
            > };
            >
            >
            > Ex.myDataTable = new
            > YAHOO.widget.DataTable("sort", myColumnDefs,
            > Ex.myDataSource);
            > Ex.updateMarks();
            > Ex.myDataTable.subscribe('renderEvent',
            > Ex.updateMarks);
            > Ex.myDataTable.subscribe('rowClickEvent',
            > Ex.updateMarks);
            >
            >
            > });
            >
            >
            >
            >
            >
            > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
            > >
            > > I can do all of them, subscribe to renderEvent, to initEvent and in
            > renderEvent putting a statement instead of a function, it all works
            > for me. Actually, the last one does give me an error, but after the
            > alert is called. I believe this is a bug because the event.js does
            > verify the callback function is a callback function, but does that
            > after the listener was actually set, or so it seems (events, being
            > asynchronous are somewhat hard to step through). So, you might have
            > discovered a bug in Event.js. Which is not what you are concerned
            > about right now so, is there somewhere we can see your code in action?
            > As I said, it works for me.
            > >
            > > Satyam
            > >
            > > ----- Original Message -----
            > > From: Shishir Jain
            > > To: ydn-javascript@yahoogroups.com
            > > Sent: Friday, May 02, 2008 1:47 PM
            > > Subject: [ydn-javascript] Subscribing to renderEvent in DataTable.
            > >
            > >
            > > Hello:
            > >
            > > I need to subscribe to renderEvent on Datatable instance. This is
            > how I'm registering it:
            > >
            > > myDatatable.subscribe("renderEvent", function()
            > > { alert('renderEvent Called");
            > > });
            > >
            > > But this does not getting called.
            > >
            > > If I do the same with "initEvent" it gets called.
            > >
            > > What is more baffling is that when I register like:
            > >
            > > myDatatable.subscribe("renderEvent", alert("renderEvent Called"));
            > >
            > > it gets called.
            > >
            > > Unable to understand what is happening. Any ideas what is the
            > correct way to register for renderEvent on datatable?
            > >
            > > Thanks & Regards,
            > > Shishir Jain.
            > >
            > >
            > >
            > >
            >
            ------------------------------------------------------------------------------
            > >
            > >
            > > No virus found in this incoming message.
            > > Checked by AVG.
            > > Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
            > 01/05/2008 17:30
            > >
            >
          • Satyam
            There are several errors in the code, perhaps it was in copying to this message, but they would cause errors that would prevent things from working properly.
            Message 5 of 7 , May 2, 2008
            • 0 Attachment
              There are several errors in the code, perhaps it was in copying to this
              message, but they would cause errors that would prevent things from working
              properly.
              In the columns definitions, the array has the last element followed by a
              comma. This comma will cause the DataTable to fail if seen in Internet
              Explorer.

              In the fields array, the curly and square brackets are not right, they are
              transposed and the contents won't make much sense ... well, it all depends
              on what was it that you meant and how you fix it.

              If all the errors are in the copying, then we are trying to fix errors which
              are not actually part of the problem but of the copying.

              Satyam


              ----- Original Message -----
              From: "traderashish" <traderashish@...>
              To: <ydn-javascript@yahoogroups.com>
              Sent: Friday, May 02, 2008 5:19 PM
              Subject: [ydn-javascript] Re: Subscribing to renderEvent in DataTable.


              >
              > I am also having the issue with renderEvent not firing.
              >
              > If I subscribe to rowClickEvent and click on a row the following code
              > works but not for renderEvent.
              >
              > I am getting data from external source as JSON.
              >
              > Ashish
              >
              > code...( I took out some unrelated lines from original code for
              > clarity like a checkbox column and some more data columns)
              >
              > YAHOO.util.Event.onDOMReady(function () {
              >
              > var Ev = YAHOO.util.Event,
              > Dom = YAHOO.util.Dom,
              > DS = YAHOO.util.DataSource,
              > Ex = YAHOO.namespace('pmc'),
              > DT = YAHOO.widget.DataTable,
              > markRecs = {},
              > data = [],
              > i = 0;
              >
              >
              > // Create a custom function to store the records needing row
              > coloring
              > YAHOO.widget.DataTable.Formatter.mark = function
              > (cell,rec,col,data) {
              > if (data == "Closed") {
              > // In object hash to prevent duplication
              > markRecs[rec.getId()] = rec;
              > for (var recKey in markRecs) {
              > alert("marks" + recKey +markRecs[recKey]);
              > }
              > }
              > cell.innerHTML = data;
              > };
              >
              >
              > var myColumnDefs = [
              > {key:"id", label:"Case Id", sortable:true},
              > {key:"status",
              > label:"Status",formatter:"mark",sortable:true},
              > ];
              >
              > Ex.myDataSource = new
              > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
              > Ex.myDataSource.responseType =
              > YAHOO.util.DataSource.TYPE_JSON;
              >
              > // When responseSchema.totalRecords is not
              > indicated, the records
              > // returned from the DataSource are assumed to
              > represent the entire set
              > Ex.myDataSource.responseSchema = {
              > resultsList: "items",
              > fields: [{key:"id","status"]};
              >
              >
              > // Function to add the color class to rows
              > Ex.updateMarks = function () {
              > alert("in update marks");
              >
              > // Clear mark class off all rows
              > Dom.removeClass(
              > Dom.getElementsByClassName('mark','tr',
              > Ex.myDataTable.getTbodyEl()),
              > 'mark');
              >
              > // Apply mark class to identified rows
              > for (var recKey in markRecs) {
              >
              > Dom.addClass(Ex.myDataTable.getTrEl(markRecs[recKey]),'mark');
              > }
              > };
              >
              >
              > Ex.myDataTable = new
              > YAHOO.widget.DataTable("sort", myColumnDefs,
              > Ex.myDataSource);
              > Ex.updateMarks();
              > Ex.myDataTable.subscribe('renderEvent',
              > Ex.updateMarks);
              > Ex.myDataTable.subscribe('rowClickEvent',
              > Ex.updateMarks);
              >
              >
              > });
              >
              >
              >
              >
              >
              > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
              >>
              >> I can do all of them, subscribe to renderEvent, to initEvent and in
              > renderEvent putting a statement instead of a function, it all works
              > for me. Actually, the last one does give me an error, but after the
              > alert is called. I believe this is a bug because the event.js does
              > verify the callback function is a callback function, but does that
              > after the listener was actually set, or so it seems (events, being
              > asynchronous are somewhat hard to step through). So, you might have
              > discovered a bug in Event.js. Which is not what you are concerned
              > about right now so, is there somewhere we can see your code in action?
              > As I said, it works for me.
              >>
              >> Satyam
              >>
              >> ----- Original Message -----
              >> From: Shishir Jain
              >> To: ydn-javascript@yahoogroups.com
              >> Sent: Friday, May 02, 2008 1:47 PM
              >> Subject: [ydn-javascript] Subscribing to renderEvent in DataTable.
              >>
              >>
              >> Hello:
              >>
              >> I need to subscribe to renderEvent on Datatable instance. This is
              > how I'm registering it:
              >>
              >> myDatatable.subscribe("renderEvent", function()
              >> { alert('renderEvent Called");
              >> });
              >>
              >> But this does not getting called.
              >>
              >> If I do the same with "initEvent" it gets called.
              >>
              >> What is more baffling is that when I register like:
              >>
              >> myDatatable.subscribe("renderEvent", alert("renderEvent Called"));
              >>
              >> it gets called.
              >>
              >> Unable to understand what is happening. Any ideas what is the
              > correct way to register for renderEvent on datatable?
              >>
              >> Thanks & Regards,
              >> Shishir Jain.
              >>
              >>
              >>
              >>
              > ------------------------------------------------------------------------------
              >>
              >>
              >> No virus found in this incoming message.
              >> Checked by AVG.
              >> Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
              > 01/05/2008 17:30
              >>
              >
              >
              >
              > ------------------------------------
              >
              > Yahoo! Groups Links
              >
              >
              >
              >
              >
              > --
              > No virus found in this incoming message.
              > Checked by AVG.
              > Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
              > 01/05/2008 17:30
              >
              >
            • traderashish
              comma was NOT copying error.Thanks so much Satyam for pointing it out. You just saved me hours of debugging on IE. I develop on mac and test on firefox and
              Message 6 of 7 , May 2, 2008
              • 0 Attachment
                comma was NOT copying error.Thanks so much Satyam for pointing it out. You just saved
                me hours of debugging on IE. I develop on mac and test on firefox and safari and neither
                of them complained. ( I am using python so probably thats why i did not find the comma
                odd.)

                Other one is copying error. My apologies. In fields: [{key:"id","status"]};, it should be {key:"id",parser:YAHOO.util.DataSource.parseNumber} not just {key:"id",. I would be very
                careful next time in posting code.

                Btw, initEvent worked so I am going ahead with that instead of renderEvent. Not sure what
                could be the implication of using initEvent instead of renderEvent.
                I am using external datasource.

                thanks
                Ashish

                --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
                >
                > There are several errors in the code, perhaps it was in copying to this
                > message, but they would cause errors that would prevent things from working
                > properly.
                > In the columns definitions, the array has the last element followed by a
                > comma. This comma will cause the DataTable to fail if seen in Internet
                > Explorer.
                >
                > In the fields array, the curly and square brackets are not right, they are
                > transposed and the contents won't make much sense ... well, it all depends
                > on what was it that you meant and how you fix it.
                >
                > If all the errors are in the copying, then we are trying to fix errors which
                > are not actually part of the problem but of the copying.
                >
                > Satyam
                >
                >
                > ----- Original Message -----
                > From: "traderashish" <traderashish@...>
                > To: <ydn-javascript@yahoogroups.com>
                > Sent: Friday, May 02, 2008 5:19 PM
                > Subject: [ydn-javascript] Re: Subscribing to renderEvent in DataTable.
                >
                >
                > >
                > > I am also having the issue with renderEvent not firing.
                > >
                > > If I subscribe to rowClickEvent and click on a row the following code
                > > works but not for renderEvent.
                > >
                > > I am getting data from external source as JSON.
                > >
                > > Ashish
                > >
                > > code...( I took out some unrelated lines from original code for
                > > clarity like a checkbox column and some more data columns)
                > >
                > > YAHOO.util.Event.onDOMReady(function () {
                > >
                > > var Ev = YAHOO.util.Event,
                > > Dom = YAHOO.util.Dom,
                > > DS = YAHOO.util.DataSource,
                > > Ex = YAHOO.namespace('pmc'),
                > > DT = YAHOO.widget.DataTable,
                > > markRecs = {},
                > > data = [],
                > > i = 0;
                > >
                > >
                > > // Create a custom function to store the records needing row
                > > coloring
                > > YAHOO.widget.DataTable.Formatter.mark = function
                > > (cell,rec,col,data) {
                > > if (data == "Closed") {
                > > // In object hash to prevent duplication
                > > markRecs[rec.getId()] = rec;
                > > for (var recKey in markRecs) {
                > > alert("marks" + recKey +markRecs[recKey]);
                > > }
                > > }
                > > cell.innerHTML = data;
                > > };
                > >
                > >
                > > var myColumnDefs = [
                > > {key:"id", label:"Case Id", sortable:true},
                > > {key:"status",
                > > label:"Status",formatter:"mark",sortable:true},
                > > ];
                > >
                > > Ex.myDataSource = new
                > > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
                > > Ex.myDataSource.responseType =
                > > YAHOO.util.DataSource.TYPE_JSON;
                > >
                > > // When responseSchema.totalRecords is not
                > > indicated, the records
                > > // returned from the DataSource are assumed to
                > > represent the entire set
                > > Ex.myDataSource.responseSchema = {
                > > resultsList: "items",
                > > fields: [{key:"id","status"]};
                > >
                > >
                > > // Function to add the color class to rows
                > > Ex.updateMarks = function () {
                > > alert("in update marks");
                > >
                > > // Clear mark class off all rows
                > > Dom.removeClass(
                > > Dom.getElementsByClassName('mark','tr',
                > > Ex.myDataTable.getTbodyEl()),
                > > 'mark');
                > >
                > > // Apply mark class to identified rows
                > > for (var recKey in markRecs) {
                > >
                > > Dom.addClass(Ex.myDataTable.getTrEl(markRecs[recKey]),'mark');
                > > }
                > > };
                > >
                > >
                > > Ex.myDataTable = new
                > > YAHOO.widget.DataTable("sort", myColumnDefs,
                > > Ex.myDataSource);
                > > Ex.updateMarks();
                > > Ex.myDataTable.subscribe('renderEvent',
                > > Ex.updateMarks);
                > > Ex.myDataTable.subscribe('rowClickEvent',
                > > Ex.updateMarks);
                > >
                > >
                > > });
                > >
                > >
                > >
                > >
                > >
                > > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
                > >>
                > >> I can do all of them, subscribe to renderEvent, to initEvent and in
                > > renderEvent putting a statement instead of a function, it all works
                > > for me. Actually, the last one does give me an error, but after the
                > > alert is called. I believe this is a bug because the event.js does
                > > verify the callback function is a callback function, but does that
                > > after the listener was actually set, or so it seems (events, being
                > > asynchronous are somewhat hard to step through). So, you might have
                > > discovered a bug in Event.js. Which is not what you are concerned
                > > about right now so, is there somewhere we can see your code in action?
                > > As I said, it works for me.
                > >>
                > >> Satyam
                > >>
                > >> ----- Original Message -----
                > >> From: Shishir Jain
                > >> To: ydn-javascript@yahoogroups.com
                > >> Sent: Friday, May 02, 2008 1:47 PM
                > >> Subject: [ydn-javascript] Subscribing to renderEvent in DataTable.
                > >>
                > >>
                > >> Hello:
                > >>
                > >> I need to subscribe to renderEvent on Datatable instance. This is
                > > how I'm registering it:
                > >>
                > >> myDatatable.subscribe("renderEvent", function()
                > >> { alert('renderEvent Called");
                > >> });
                > >>
                > >> But this does not getting called.
                > >>
                > >> If I do the same with "initEvent" it gets called.
                > >>
                > >> What is more baffling is that when I register like:
                > >>
                > >> myDatatable.subscribe("renderEvent", alert("renderEvent Called"));
                > >>
                > >> it gets called.
                > >>
                > >> Unable to understand what is happening. Any ideas what is the
                > > correct way to register for renderEvent on datatable?
                > >>
                > >> Thanks & Regards,
                > >> Shishir Jain.
                > >>
                > >>
                > >>
                > >>
                > > ------------------------------------------------------------------
                ------------
                > >>
                > >>
                > >> No virus found in this incoming message.
                > >> Checked by AVG.
                > >> Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
                > > 01/05/2008 17:30
                > >>
                > >
                > >
                > >
                > > ------------------------------------
                > >
                > > Yahoo! Groups Links
                > >
                > >
                > >
                > >
                > >
                > > --
                > > No virus found in this incoming message.
                > > Checked by AVG.
                > > Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
                > > 01/05/2008 17:30
                > >
                > >
                >
              • Satyam
                renderEvent will be triggered on things like sorting by column, adding rows, client-side paging (not sure about server-side) and anything that might force a
                Message 7 of 7 , May 2, 2008
                • 0 Attachment
                  renderEvent will be triggered on things like sorting by column, adding rows,
                  client-side paging (not sure about server-side) and anything that might
                  force a redraw of the table. You only get one initEvent per table created
                  though I am not sure what happens when you do server-side paging.

                  Satyam

                  ----- Original Message -----
                  From: "traderashish" <traderashish@...>
                  To: <ydn-javascript@yahoogroups.com>
                  Sent: Friday, May 02, 2008 8:00 PM
                  Subject: [ydn-javascript] Re: Subscribing to renderEvent in DataTable.


                  > comma was NOT copying error.Thanks so much Satyam for pointing it out. You
                  > just saved
                  > me hours of debugging on IE. I develop on mac and test on firefox and
                  > safari and neither
                  > of them complained. ( I am using python so probably thats why i did not
                  > find the comma
                  > odd.)
                  >
                  > Other one is copying error. My apologies. In fields:
                  > [{key:"id","status"]};, it should be
                  > {key:"id",parser:YAHOO.util.DataSource.parseNumber} not just {key:"id",. I
                  > would be very
                  > careful next time in posting code.
                  >
                  > Btw, initEvent worked so I am going ahead with that instead of
                  > renderEvent. Not sure what
                  > could be the implication of using initEvent instead of renderEvent.
                  > I am using external datasource.
                  >
                  > thanks
                  > Ashish
                  >
                  > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
                  >>
                  >> There are several errors in the code, perhaps it was in copying to this
                  >> message, but they would cause errors that would prevent things from
                  >> working
                  >> properly.
                  >> In the columns definitions, the array has the last element followed by a
                  >> comma. This comma will cause the DataTable to fail if seen in Internet
                  >> Explorer.
                  >>
                  >> In the fields array, the curly and square brackets are not right, they
                  >> are
                  >> transposed and the contents won't make much sense ... well, it all
                  >> depends
                  >> on what was it that you meant and how you fix it.
                  >>
                  >> If all the errors are in the copying, then we are trying to fix errors
                  >> which
                  >> are not actually part of the problem but of the copying.
                  >>
                  >> Satyam
                  >>
                  >>
                  >> ----- Original Message -----
                  >> From: "traderashish" <traderashish@...>
                  >> To: <ydn-javascript@yahoogroups.com>
                  >> Sent: Friday, May 02, 2008 5:19 PM
                  >> Subject: [ydn-javascript] Re: Subscribing to renderEvent in DataTable.
                  >>
                  >>
                  >> >
                  >> > I am also having the issue with renderEvent not firing.
                  >> >
                  >> > If I subscribe to rowClickEvent and click on a row the following code
                  >> > works but not for renderEvent.
                  >> >
                  >> > I am getting data from external source as JSON.
                  >> >
                  >> > Ashish
                  >> >
                  >> > code...( I took out some unrelated lines from original code for
                  >> > clarity like a checkbox column and some more data columns)
                  >> >
                  >> > YAHOO.util.Event.onDOMReady(function () {
                  >> >
                  >> > var Ev = YAHOO.util.Event,
                  >> > Dom = YAHOO.util.Dom,
                  >> > DS = YAHOO.util.DataSource,
                  >> > Ex = YAHOO.namespace('pmc'),
                  >> > DT = YAHOO.widget.DataTable,
                  >> > markRecs = {},
                  >> > data = [],
                  >> > i = 0;
                  >> >
                  >> >
                  >> > // Create a custom function to store the records needing row
                  >> > coloring
                  >> > YAHOO.widget.DataTable.Formatter.mark = function
                  >> > (cell,rec,col,data) {
                  >> > if (data == "Closed") {
                  >> > // In object hash to prevent duplication
                  >> > markRecs[rec.getId()] = rec;
                  >> > for (var recKey in markRecs) {
                  >> > alert("marks" + recKey +markRecs[recKey]);
                  >> > }
                  >> > }
                  >> > cell.innerHTML = data;
                  >> > };
                  >> >
                  >> >
                  >> > var myColumnDefs = [
                  >> > {key:"id", label:"Case Id", sortable:true},
                  >> > {key:"status",
                  >> > label:"Status",formatter:"mark",sortable:true},
                  >> > ];
                  >> >
                  >> > Ex.myDataSource = new
                  >> > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
                  >> > Ex.myDataSource.responseType =
                  >> > YAHOO.util.DataSource.TYPE_JSON;
                  >> >
                  >> > // When responseSchema.totalRecords is not
                  >> > indicated, the records
                  >> > // returned from the DataSource are assumed to
                  >> > represent the entire set
                  >> > Ex.myDataSource.responseSchema = {
                  >> > resultsList: "items",
                  >> > fields: [{key:"id","status"]};
                  >> >
                  >> >
                  >> > // Function to add the color class to rows
                  >> > Ex.updateMarks = function () {
                  >> > alert("in update marks");
                  >> >
                  >> > // Clear mark class off all rows
                  >> > Dom.removeClass(
                  >> > Dom.getElementsByClassName('mark','tr',
                  >> > Ex.myDataTable.getTbodyEl()),
                  >> > 'mark');
                  >> >
                  >> > // Apply mark class to identified rows
                  >> > for (var recKey in markRecs) {
                  >> >
                  >> > Dom.addClass(Ex.myDataTable.getTrEl(markRecs[recKey]),'mark');
                  >> > }
                  >> > };
                  >> >
                  >> >
                  >> > Ex.myDataTable = new
                  >> > YAHOO.widget.DataTable("sort", myColumnDefs,
                  >> > Ex.myDataSource);
                  >> > Ex.updateMarks();
                  >> > Ex.myDataTable.subscribe('renderEvent',
                  >> > Ex.updateMarks);
                  >> > Ex.myDataTable.subscribe('rowClickEvent',
                  >> > Ex.updateMarks);
                  >> >
                  >> >
                  >> > });
                  >> >
                  >> >
                  >> >
                  >> >
                  >> >
                  >> > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
                  >> >>
                  >> >> I can do all of them, subscribe to renderEvent, to initEvent and in
                  >> > renderEvent putting a statement instead of a function, it all works
                  >> > for me. Actually, the last one does give me an error, but after the
                  >> > alert is called. I believe this is a bug because the event.js does
                  >> > verify the callback function is a callback function, but does that
                  >> > after the listener was actually set, or so it seems (events, being
                  >> > asynchronous are somewhat hard to step through). So, you might have
                  >> > discovered a bug in Event.js. Which is not what you are concerned
                  >> > about right now so, is there somewhere we can see your code in action?
                  >> > As I said, it works for me.
                  >> >>
                  >> >> Satyam
                  >> >>
                  >> >> ----- Original Message -----
                  >> >> From: Shishir Jain
                  >> >> To: ydn-javascript@yahoogroups.com
                  >> >> Sent: Friday, May 02, 2008 1:47 PM
                  >> >> Subject: [ydn-javascript] Subscribing to renderEvent in DataTable.
                  >> >>
                  >> >>
                  >> >> Hello:
                  >> >>
                  >> >> I need to subscribe to renderEvent on Datatable instance. This is
                  >> > how I'm registering it:
                  >> >>
                  >> >> myDatatable.subscribe("renderEvent", function()
                  >> >> { alert('renderEvent Called");
                  >> >> });
                  >> >>
                  >> >> But this does not getting called.
                  >> >>
                  >> >> If I do the same with "initEvent" it gets called.
                  >> >>
                  >> >> What is more baffling is that when I register like:
                  >> >>
                  >> >> myDatatable.subscribe("renderEvent", alert("renderEvent Called"));
                  >> >>
                  >> >> it gets called.
                  >> >>
                  >> >> Unable to understand what is happening. Any ideas what is the
                  >> > correct way to register for renderEvent on datatable?
                  >> >>
                  >> >> Thanks & Regards,
                  >> >> Shishir Jain.
                  >> >>
                  >> >>
                  >> >>
                  >> >>
                  >> > ------------------------------------------------------------------
                  > ------------
                  >> >>
                  >> >>
                  >> >> No virus found in this incoming message.
                  >> >> Checked by AVG.
                  >> >> Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
                  >> > 01/05/2008 17:30
                  >> >>
                  >> >
                  >> >
                  >> >
                  >> > ------------------------------------
                  >> >
                  >> > Yahoo! Groups Links
                  >> >
                  >> >
                  >> >
                  >> >
                  >> >
                  >> > --
                  >> > No virus found in this incoming message.
                  >> > Checked by AVG.
                  >> > Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
                  >> > 01/05/2008 17:30
                  >> >
                  >> >
                  >>
                  >
                  >
                  >
                  >
                  > ------------------------------------
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  > --
                  > No virus found in this incoming message.
                  > Checked by AVG.
                  > Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
                  > 01/05/2008 17:30
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.