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

Re: Datatable row coloring

Expand Messages
  • y_lsmith
    Ashish, I threw together this example page for you (and all). The row isn t available
    Message 1 of 24 , Apr 30, 2008
    • 0 Attachment
      Ashish,

      I threw together this example page for you (and all).  The row isn't available to the formatters, but the record is and can be cached for manipulating the rows at a later point (from a renderEvent listener).

      Hope this helps,
      Luke

      --- In ydn-javascript@yahoogroups.com, "traderashish" <traderashish@...> wrote:
      >
      > Submitted enhancement request.
      > Does not look like anyone has been figure out solution to this.
      >
      >
      > --- In ydn-javascript@yahoogroups.com, "traderashish" traderashish@ wrote:
      > >
      > > Reposting last time, to find if anyone has example of how to change color of datatable
      > row
      > > based on the value in a column for that row.
      > >
      > > Ashish
      > >
      > > --- In ydn-javascript@yahoogroups.com, "traderashish" <traderashish@> wrote:
      > > >
      > > > If some one got this to work, can you please post some sample code on how to do it.
      > > >
      > > >
      > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@> wrote:
      > > > >
      > > > > I guess another way to put it is how to access the table row during
      > > > > the initial setup (another question is how I can get the row ID during
      > > > > the same request - but this would be taken care of if I knew the
      > > > > former :) )
      > > > >
      > > > > Robert
      > > > >
      > > > >
      > > > >
      > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@> wrote:
      > > > > >
      > > > > > How can you change the color of a row on the initial table load? it
      > > > > > seems rowAddEvent isn't being called until after the first population.
      > > > > >
      > > > > > Robert
      > > > > >
      > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
      > > > > > <arnaud.limbourg@> wrote:
      > > > > > >
      > > > > > > Thanks for the info.
      > > > > > >
      > > > > > > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
      > > > > > > >
      > > > > > > > You got it right, I'm outdated ... generally speaking. This has
      > > > > > > changed
      > > > > > > > since 2.4.1 when the cell was added to the row, which had already
      > > > > > > been added
      > > > > > > > to the table before formatCell was called. This is not the case now
      > > > > > > in 2.5.0
      > > > > > > > but can't complain about it because nobody said it was a supported
      > > > > > > > interface.
      > > > > > > >
      > > > > > > > You are right as well about using rowAddEvent, everything is
      > > > > > settled by
      > > > > > > > then.
      > > > > > > >
      > > > > > > > Thanks for the update, I'll keep it in mind.
      > > > > > > >
      > > > > > > > Satyam
      > > > > > > >
      > > > > > > > ----- Original Message -----
      > > > > > > > From: "Fernando Machado" <fm@>
      > > > > > > > To: ydn-javascript@yahoogroups.com
      > > > > > > > Sent: Thursday, March 06, 2008 9:53 PM
      > > > > > > > Subject: [ydn-javascript] Re: Datatable row coloring
      > > > > > > >
      > > > > > > >
      > > > > > > > > Hi,
      > > > > > > > >
      > > > > > > > > I've the same problem here.
      > > > > > > > >
      > > > > > > > > With 2.5.0 version, you cannot use DataTable.getTrEl inside your
      > > > > > > > > custom cell format function. And the reason is: the current row
      > > > > > > > > wasn't appended to the table.
      > > > > > > > >
      > > > > > > > > If I'm not wrong, here is the flow:
      > > > > > > > >
      > > > > > > > > datatable-beta-debug.js
      > > > > > > > > +(10410) addRow : function(oData, index)
      > > > > > > > > +(7428) _createTrEl : function (oRecord)
      > > > > > > > > +(7449) _updateTrEl : function(elRow, oRecord)
      > > > > > > > > +(10820) formatCell : function(elCell, oRecord, oColumn)
      > > > > > > > > + [here you try to get the TR elmnt]
      > > > > > > > > +(10470) this._elTbody.appendChild(elNewTr);
      > > > > > > > >
      > > > > > > > > Maybe the correct way is change the row color in rowAddEvent.
      > > > > > > > >
      > > > > > > > > Cheers,
      > > > > > > > >
      > > > > > > > > fmachado
      > > > > > > > >
      > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
      > > > > > > > > <arnaud.limbourg@> wrote:
      > > > > > > > >>
      > > > > > > > >> --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
      > > > > > > > >> >
      > > > > > > > >> > Try:
      > > > > > > > >> >
      > > > > > > > >> > var colorRows = function(elCell, oRecord, oColumn, oData) {
      > > > > > > > >> > var tr = this.getTrEl(elCell);
      > > > > > > > >> > YAHOO.util.Dom.addClass(tr, 'myclass');
      > > > > > > > >> > }
      > > > > > > > >> >
      > > > > > > > >> > What you did should work. Since it doesn't and if the above
      > > > > > does,
      > > > > > > > >> please
      > > > > > > > >> > file a bug report on SourceForge, I haven't seen anything that
      > > > > > > would
      > > > > > > > >> > indicate that what you did is no longer valid. The above,
      > > > > > > though, is
      > > > > > > > >> > faster.
      > > > > > > > >> >
      > > > > > > > >> > Satyam
      > > > > > > > >>
      > > > > > > > >> No luck. I'll file a bug because using DataSource.sendRequest()
      > > > > > makes
      > > > > > > > >> the formatting work as expected.
      > > > > > > > >>
      > > > > > > > >> I was not able to track this down.
      > > > > > > > >>
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > > Yahoo! Groups Links
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > > --
      > > > > > > > > No virus found in this incoming message.
      > > > > > > > > Checked by AVG Free Edition.
      > > > > > > > > Version: 7.5.516 / Virus Database: 269.21.5/1314 - Release Date:
      > > > > > > > > 05/03/2008 18:38
      > > > > > > > >
      > > > > > > > >
      > > > > > > >
      > > > > > >
      > > > > >
      > > > >
      > > >
      > >
      >
    • traderashish
      Hi Luke, I think in my case renderEvent is not firing. The data table displays but no class is marked. even though marksRecs has the row. on click row click
      Message 2 of 24 , May 1, 2008
      • 0 Attachment
        Hi Luke,

        I think in my case renderEvent is not firing. The data table displays
        but no class is marked. even though marksRecs has the row.
        on click row click event is firing. I was earlier on 2.5.0 and just
        upgraded to 2.5.1 and with no luck

        I have defined all the 2.5.1 source files specified on the yui data
        table page,



        here is code,

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

        var Ev = YAHOO.util.Event,
        Dom = YAHOO.util.Dom,
        DS = YAHOO.util.DataSource,
        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);
        }
        }
        cell.innerHTML = data;
        };



        var myColumnDefs = [
        {key:"id", label:"Case Id", sortable:true},

        {key:"status",label:"Status",formatter:"mark",sortable:true},
        ];

        this.myDataSource = new
        YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
        this.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
        this.myDataSource.responseSchema = {
        resultsList: "items",
        fields:
        [{key:"id",parser:YAHOO.util.DataSource.parseNumber},"status"]};

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

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

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

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


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





        });







        --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@...> wrote:
        >
        > Ashish,
        >
        > I threw together this example
        > <http://yuiblog.com/sandbox/yui/v251/examples/datatable/row_color.html>
        > page for you (and all). The row isn't available to the formatters, but
        > the record is and can be cached for manipulating the rows at a later
        > point (from a renderEvent listener).
        >
        > Hope this helps,
        > Luke
        >
        > --- In ydn-javascript@yahoogroups.com, "traderashish" <traderashish@>
        > wrote:
        > >
        > > Submitted enhancement request.
        > > Does not look like anyone has been figure out solution to this.
        > >
        > >
        > > --- In ydn-javascript@yahoogroups.com, "traderashish" traderashish@
        > wrote:
        > > >
        > > > Reposting last time, to find if anyone has example of how to change
        > color of datatable
        > > row
        > > > based on the value in a column for that row.
        > > >
        > > > Ashish
        > > >
        > > > --- In ydn-javascript@yahoogroups.com, "traderashish"
        > <traderashish@> wrote:
        > > > >
        > > > > If some one got this to work, can you please post some sample code
        > on how to do it.
        > > > >
        > > > >
        > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@> wrote:
        > > > > >
        > > > > > I guess another way to put it is how to access the table row
        > during
        > > > > > the initial setup (another question is how I can get the row ID
        > during
        > > > > > the same request - but this would be taken care of if I knew the
        > > > > > former :) )
        > > > > >
        > > > > > Robert
        > > > > >
        > > > > >
        > > > > >
        > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@> wrote:
        > > > > > >
        > > > > > > How can you change the color of a row on the initial table
        > load? it
        > > > > > > seems rowAddEvent isn't being called until after the first
        > population.
        > > > > > >
        > > > > > > Robert
        > > > > > >
        > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
        > > > > > > <arnaud.limbourg@> wrote:
        > > > > > > >
        > > > > > > > Thanks for the info.
        > > > > > > >
        > > > > > > > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@>
        > wrote:
        > > > > > > > >
        > > > > > > > > You got it right, I'm outdated ... generally speaking.
        > This has
        > > > > > > > changed
        > > > > > > > > since 2.4.1 when the cell was added to the row, which had
        > already
        > > > > > > > been added
        > > > > > > > > to the table before formatCell was called. This is not the
        > case now
        > > > > > > > in 2.5.0
        > > > > > > > > but can't complain about it because nobody said it was a
        > supported
        > > > > > > > > interface.
        > > > > > > > >
        > > > > > > > > You are right as well about using rowAddEvent, everything
        > is
        > > > > > > settled by
        > > > > > > > > then.
        > > > > > > > >
        > > > > > > > > Thanks for the update, I'll keep it in mind.
        > > > > > > > >
        > > > > > > > > Satyam
        > > > > > > > >
        > > > > > > > > ----- Original Message -----
        > > > > > > > > From: "Fernando Machado" <fm@>
        > > > > > > > > To: ydn-javascript@yahoogroups.com
        > > > > > > > > Sent: Thursday, March 06, 2008 9:53 PM
        > > > > > > > > Subject: [ydn-javascript] Re: Datatable row coloring
        > > > > > > > >
        > > > > > > > >
        > > > > > > > > > Hi,
        > > > > > > > > >
        > > > > > > > > > I've the same problem here.
        > > > > > > > > >
        > > > > > > > > > With 2.5.0 version, you cannot use DataTable.getTrEl
        > inside your
        > > > > > > > > > custom cell format function. And the reason is: the
        > current row
        > > > > > > > > > wasn't appended to the table.
        > > > > > > > > >
        > > > > > > > > > If I'm not wrong, here is the flow:
        > > > > > > > > >
        > > > > > > > > > datatable-beta-debug.js
        > > > > > > > > > +(10410) addRow : function(oData, index)
        > > > > > > > > > +(7428) _createTrEl : function (oRecord)
        > > > > > > > > > +(7449) _updateTrEl : function(elRow, oRecord)
        > > > > > > > > > +(10820) formatCell : function(elCell, oRecord,
        > oColumn)
        > > > > > > > > > + [here you try to get the TR elmnt]
        > > > > > > > > > +(10470) this._elTbody.appendChild(elNewTr);
        > > > > > > > > >
        > > > > > > > > > Maybe the correct way is change the row color in
        > rowAddEvent.
        > > > > > > > > >
        > > > > > > > > > Cheers,
        > > > > > > > > >
        > > > > > > > > > fmachado
        > > > > > > > > >
        > > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
        > > > > > > > > > <arnaud.limbourg@> wrote:
        > > > > > > > > >>
        > > > > > > > > >> --- In ydn-javascript@yahoogroups.com, "Satyam"
        > <satyam@> wrote:
        > > > > > > > > >> >
        > > > > > > > > >> > Try:
        > > > > > > > > >> >
        > > > > > > > > >> > var colorRows = function(elCell, oRecord, oColumn,
        > oData) {
        > > > > > > > > >> > var tr = this.getTrEl(elCell);
        > > > > > > > > >> > YAHOO.util.Dom.addClass(tr, 'myclass');
        > > > > > > > > >> > }
        > > > > > > > > >> >
        > > > > > > > > >> > What you did should work. Since it doesn't and if
        > the above
        > > > > > > does,
        > > > > > > > > >> please
        > > > > > > > > >> > file a bug report on SourceForge, I haven't seen
        > anything that
        > > > > > > > would
        > > > > > > > > >> > indicate that what you did is no longer valid. The
        > above,
        > > > > > > > though, is
        > > > > > > > > >> > faster.
        > > > > > > > > >> >
        > > > > > > > > >> > Satyam
        > > > > > > > > >>
        > > > > > > > > >> No luck. I'll file a bug because using
        > DataSource.sendRequest()
        > > > > > > makes
        > > > > > > > > >> the formatting work as expected.
        > > > > > > > > >>
        > > > > > > > > >> I was not able to track this down.
        > > > > > > > > >>
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > > Yahoo! Groups Links
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > > > --
        > > > > > > > > > No virus found in this incoming message.
        > > > > > > > > > Checked by AVG Free Edition.
        > > > > > > > > > Version: 7.5.516 / Virus Database: 269.21.5/1314 -
        > Release Date:
        > > > > > > > > > 05/03/2008 18:38
        > > > > > > > > >
        > > > > > > > > >
        > > > > > > > >
        > > > > > > >
        > > > > > >
        > > > > >
        > > > >
        > > >
        > >
        >
      • traderashish
        I added, Ex.myDataTable.subscribe( rowClickEvent , Ex.updateMarks); and when I click any row, it works perfectly. but renderEvent is not working,
        Message 3 of 24 , May 1, 2008
        • 0 Attachment
          I added,
          Ex.myDataTable.subscribe('rowClickEvent', Ex.updateMarks);
          and when I click any row, it works perfectly.

          but 'renderEvent' is not working,
          this.myDataTable.subscribe('renderEvent',
          this.updateMarks);

          any clues?

          Is it because, I using external data source

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


          ashish

          --- In ydn-javascript@yahoogroups.com, "traderashish"
          <traderashish@...> wrote:
          >
          > Hi Luke,
          >
          > I think in my case renderEvent is not firing. The data table displays
          > but no class is marked. even though marksRecs has the row.
          > on click row click event is firing. I was earlier on 2.5.0 and just
          > upgraded to 2.5.1 and with no luck
          >
          > I have defined all the 2.5.1 source files specified on the yui data
          > table page,
          >
          >
          >
          > here is code,
          >
          > YAHOO.util.Event.onDOMReady(function () {
          >
          > var Ev = YAHOO.util.Event,
          > Dom = YAHOO.util.Dom,
          > DS = YAHOO.util.DataSource,
          > 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);
          > }
          > }
          > cell.innerHTML = data;
          > };
          >
          >
          >
          > var myColumnDefs = [
          > {key:"id", label:"Case Id", sortable:true},
          >
          > {key:"status",label:"Status",formatter:"mark",sortable:true},
          > ];
          >
          > this.myDataSource = new
          > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
          > this.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
          > this.myDataSource.responseSchema = {
          > resultsList: "items",
          > fields:
          > [{key:"id",parser:YAHOO.util.DataSource.parseNumber},"status"]};
          >
          > // Function to add the color class to rows
          > this.updateMarks = function () {
          > alert("in update marks");
          >
          > // Clear mark class off all rows
          > Dom.removeClass(
          > Dom.getElementsByClassName('mark','tr',
          > this.myDataTable.getTbodyEl()),
          > 'mark');
          >
          > // Apply mark class to identified rows
          > for (var recKey in markRecs) {
          >
          > Dom.addClass(this.myDataTable.getTrEl(markRecs[recKey]),'mark');
          > }
          > };
          >
          >
          > this.myDataTable = new
          > YAHOO.widget.DataTable("sort", myColumnDefs,
          > this.myDataSource);
          > this.updateMarks();
          > this.myDataTable.subscribe('renderEvent',
          > this.updateMarks);
          > this.myDataTable.subscribe('rowClickEvent',
          > this.updateMarks);
          >
          >
          >
          >
          >
          > });
          >
          >
          >
          >
          >
          >
          >
          > --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@> wrote:
          > >
          > > Ashish,
          > >
          > > I threw together this example
          > >
          <http://yuiblog.com/sandbox/yui/v251/examples/datatable/row_color.html>
          > > page for you (and all). The row isn't available to the
          formatters, but
          > > the record is and can be cached for manipulating the rows at a later
          > > point (from a renderEvent listener).
          > >
          > > Hope this helps,
          > > Luke
          > >
          > > --- In ydn-javascript@yahoogroups.com, "traderashish" <traderashish@>
          > > wrote:
          > > >
          > > > Submitted enhancement request.
          > > > Does not look like anyone has been figure out solution to this.
          > > >
          > > >
          > > > --- In ydn-javascript@yahoogroups.com, "traderashish" traderashish@
          > > wrote:
          > > > >
          > > > > Reposting last time, to find if anyone has example of how to
          change
          > > color of datatable
          > > > row
          > > > > based on the value in a column for that row.
          > > > >
          > > > > Ashish
          > > > >
          > > > > --- In ydn-javascript@yahoogroups.com, "traderashish"
          > > <traderashish@> wrote:
          > > > > >
          > > > > > If some one got this to work, can you please post some
          sample code
          > > on how to do it.
          > > > > >
          > > > > >
          > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@> wrote:
          > > > > > >
          > > > > > > I guess another way to put it is how to access the table row
          > > during
          > > > > > > the initial setup (another question is how I can get the
          row ID
          > > during
          > > > > > > the same request - but this would be taken care of if I
          knew the
          > > > > > > former :) )
          > > > > > >
          > > > > > > Robert
          > > > > > >
          > > > > > >
          > > > > > >
          > > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@>
          wrote:
          > > > > > > >
          > > > > > > > How can you change the color of a row on the initial table
          > > load? it
          > > > > > > > seems rowAddEvent isn't being called until after the first
          > > population.
          > > > > > > >
          > > > > > > > Robert
          > > > > > > >
          > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
          > > > > > > > <arnaud.limbourg@> wrote:
          > > > > > > > >
          > > > > > > > > Thanks for the info.
          > > > > > > > >
          > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@>
          > > wrote:
          > > > > > > > > >
          > > > > > > > > > You got it right, I'm outdated ... generally speaking.
          > > This has
          > > > > > > > > changed
          > > > > > > > > > since 2.4.1 when the cell was added to the row,
          which had
          > > already
          > > > > > > > > been added
          > > > > > > > > > to the table before formatCell was called. This is
          not the
          > > case now
          > > > > > > > > in 2.5.0
          > > > > > > > > > but can't complain about it because nobody said it was a
          > > supported
          > > > > > > > > > interface.
          > > > > > > > > >
          > > > > > > > > > You are right as well about using rowAddEvent,
          everything
          > > is
          > > > > > > > settled by
          > > > > > > > > > then.
          > > > > > > > > >
          > > > > > > > > > Thanks for the update, I'll keep it in mind.
          > > > > > > > > >
          > > > > > > > > > Satyam
          > > > > > > > > >
          > > > > > > > > > ----- Original Message -----
          > > > > > > > > > From: "Fernando Machado" <fm@>
          > > > > > > > > > To: ydn-javascript@yahoogroups.com
          > > > > > > > > > Sent: Thursday, March 06, 2008 9:53 PM
          > > > > > > > > > Subject: [ydn-javascript] Re: Datatable row coloring
          > > > > > > > > >
          > > > > > > > > >
          > > > > > > > > > > Hi,
          > > > > > > > > > >
          > > > > > > > > > > I've the same problem here.
          > > > > > > > > > >
          > > > > > > > > > > With 2.5.0 version, you cannot use DataTable.getTrEl
          > > inside your
          > > > > > > > > > > custom cell format function. And the reason is: the
          > > current row
          > > > > > > > > > > wasn't appended to the table.
          > > > > > > > > > >
          > > > > > > > > > > If I'm not wrong, here is the flow:
          > > > > > > > > > >
          > > > > > > > > > > datatable-beta-debug.js
          > > > > > > > > > > +(10410) addRow : function(oData, index)
          > > > > > > > > > > +(7428) _createTrEl : function (oRecord)
          > > > > > > > > > > +(7449) _updateTrEl : function(elRow, oRecord)
          > > > > > > > > > > +(10820) formatCell : function(elCell, oRecord,
          > > oColumn)
          > > > > > > > > > > + [here you try to get the TR elmnt]
          > > > > > > > > > > +(10470) this._elTbody.appendChild(elNewTr);
          > > > > > > > > > >
          > > > > > > > > > > Maybe the correct way is change the row color in
          > > rowAddEvent.
          > > > > > > > > > >
          > > > > > > > > > > Cheers,
          > > > > > > > > > >
          > > > > > > > > > > fmachado
          > > > > > > > > > >
          > > > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud
          Limbourg"
          > > > > > > > > > > <arnaud.limbourg@> wrote:
          > > > > > > > > > >>
          > > > > > > > > > >> --- In ydn-javascript@yahoogroups.com, "Satyam"
          > > <satyam@> wrote:
          > > > > > > > > > >> >
          > > > > > > > > > >> > Try:
          > > > > > > > > > >> >
          > > > > > > > > > >> > var colorRows = function(elCell, oRecord, oColumn,
          > > oData) {
          > > > > > > > > > >> > var tr = this.getTrEl(elCell);
          > > > > > > > > > >> > YAHOO.util.Dom.addClass(tr, 'myclass');
          > > > > > > > > > >> > }
          > > > > > > > > > >> >
          > > > > > > > > > >> > What you did should work. Since it doesn't and if
          > > the above
          > > > > > > > does,
          > > > > > > > > > >> please
          > > > > > > > > > >> > file a bug report on SourceForge, I haven't seen
          > > anything that
          > > > > > > > > would
          > > > > > > > > > >> > indicate that what you did is no longer valid. The
          > > above,
          > > > > > > > > though, is
          > > > > > > > > > >> > faster.
          > > > > > > > > > >> >
          > > > > > > > > > >> > Satyam
          > > > > > > > > > >>
          > > > > > > > > > >> No luck. I'll file a bug because using
          > > DataSource.sendRequest()
          > > > > > > > makes
          > > > > > > > > > >> the formatting work as expected.
          > > > > > > > > > >>
          > > > > > > > > > >> I was not able to track this down.
          > > > > > > > > > >>
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > > Yahoo! Groups Links
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > > > --
          > > > > > > > > > > No virus found in this incoming message.
          > > > > > > > > > > Checked by AVG Free Edition.
          > > > > > > > > > > Version: 7.5.516 / Virus Database: 269.21.5/1314 -
          > > Release Date:
          > > > > > > > > > > 05/03/2008 18:38
          > > > > > > > > > >
          > > > > > > > > > >
          > > > > > > > > >
          > > > > > > > >
          > > > > > > >
          > > > > > >
          > > > > >
          > > > >
          > > >
          > >
          >
        • y_lsmith
          For remote DataSources, try subscribing to both the renderEvent and the initEvent. Luke ...
          Message 4 of 24 , May 2, 2008
          • 0 Attachment
            For remote DataSources, try subscribing to both the renderEvent and
            the initEvent.

            Luke


            --- In ydn-javascript@yahoogroups.com, "traderashish"
            <traderashish@...> wrote:
            >
            > Hi Luke,
            >
            > I think in my case renderEvent is not firing. The data table displays
            > but no class is marked. even though marksRecs has the row.
            > on click row click event is firing. I was earlier on 2.5.0 and just
            > upgraded to 2.5.1 and with no luck
            >
            > I have defined all the 2.5.1 source files specified on the yui data
            > table page,
            >
            >
            >
            > here is code,
            >
            > YAHOO.util.Event.onDOMReady(function () {
            >
            > var Ev = YAHOO.util.Event,
            > Dom = YAHOO.util.Dom,
            > DS = YAHOO.util.DataSource,
            > 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);
            > }
            > }
            > cell.innerHTML = data;
            > };
            >
            >
            >
            > var myColumnDefs = [
            > {key:"id", label:"Case Id", sortable:true},
            >
            > {key:"status",label:"Status",formatter:"mark",sortable:true},
            > ];
            >
            > this.myDataSource = new
            > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
            > this.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
            > this.myDataSource.responseSchema = {
            > resultsList: "items",
            > fields:
            > [{key:"id",parser:YAHOO.util.DataSource.parseNumber},"status"]};
            >
            > // Function to add the color class to rows
            > this.updateMarks = function () {
            > alert("in update marks");
            >
            > // Clear mark class off all rows
            > Dom.removeClass(
            > Dom.getElementsByClassName('mark','tr',
            > this.myDataTable.getTbodyEl()),
            > 'mark');
            >
            > // Apply mark class to identified rows
            > for (var recKey in markRecs) {
            >
            > Dom.addClass(this.myDataTable.getTrEl(markRecs[recKey]),'mark');
            > }
            > };
            >
            >
            > this.myDataTable = new
            > YAHOO.widget.DataTable("sort", myColumnDefs,
            > this.myDataSource);
            > this.updateMarks();
            > this.myDataTable.subscribe('renderEvent',
            > this.updateMarks);
            > this.myDataTable.subscribe('rowClickEvent',
            > this.updateMarks);
            >
            >
            >
            >
            >
            > });
            >
            >
            >
            >
            >
            >
            >
            > --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@> wrote:
            > >
            > > Ashish,
            > >
            > > I threw together this example
            > >
            <http://yuiblog.com/sandbox/yui/v251/examples/datatable/row_color.html>
            > > page for you (and all). The row isn't available to the
            formatters, but
            > > the record is and can be cached for manipulating the rows at a later
            > > point (from a renderEvent listener).
            > >
            > > Hope this helps,
            > > Luke
            > >
            > > --- In ydn-javascript@yahoogroups.com, "traderashish" <traderashish@>
            > > wrote:
            > > >
            > > > Submitted enhancement request.
            > > > Does not look like anyone has been figure out solution to this.
            > > >
            > > >
            > > > --- In ydn-javascript@yahoogroups.com, "traderashish" traderashish@
            > > wrote:
            > > > >
            > > > > Reposting last time, to find if anyone has example of how to
            change
            > > color of datatable
            > > > row
            > > > > based on the value in a column for that row.
            > > > >
            > > > > Ashish
            > > > >
            > > > > --- In ydn-javascript@yahoogroups.com, "traderashish"
            > > <traderashish@> wrote:
            > > > > >
            > > > > > If some one got this to work, can you please post some
            sample code
            > > on how to do it.
            > > > > >
            > > > > >
            > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@> wrote:
            > > > > > >
            > > > > > > I guess another way to put it is how to access the table row
            > > during
            > > > > > > the initial setup (another question is how I can get the
            row ID
            > > during
            > > > > > > the same request - but this would be taken care of if I
            knew the
            > > > > > > former :) )
            > > > > > >
            > > > > > > Robert
            > > > > > >
            > > > > > >
            > > > > > >
            > > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@>
            wrote:
            > > > > > > >
            > > > > > > > How can you change the color of a row on the initial table
            > > load? it
            > > > > > > > seems rowAddEvent isn't being called until after the first
            > > population.
            > > > > > > >
            > > > > > > > Robert
            > > > > > > >
            > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
            > > > > > > > <arnaud.limbourg@> wrote:
            > > > > > > > >
            > > > > > > > > Thanks for the info.
            > > > > > > > >
            > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@>
            > > wrote:
            > > > > > > > > >
            > > > > > > > > > You got it right, I'm outdated ... generally speaking.
            > > This has
            > > > > > > > > changed
            > > > > > > > > > since 2.4.1 when the cell was added to the row,
            which had
            > > already
            > > > > > > > > been added
            > > > > > > > > > to the table before formatCell was called. This is
            not the
            > > case now
            > > > > > > > > in 2.5.0
            > > > > > > > > > but can't complain about it because nobody said it was a
            > > supported
            > > > > > > > > > interface.
            > > > > > > > > >
            > > > > > > > > > You are right as well about using rowAddEvent,
            everything
            > > is
            > > > > > > > settled by
            > > > > > > > > > then.
            > > > > > > > > >
            > > > > > > > > > Thanks for the update, I'll keep it in mind.
            > > > > > > > > >
            > > > > > > > > > Satyam
            > > > > > > > > >
            > > > > > > > > > ----- Original Message -----
            > > > > > > > > > From: "Fernando Machado" <fm@>
            > > > > > > > > > To: ydn-javascript@yahoogroups.com
            > > > > > > > > > Sent: Thursday, March 06, 2008 9:53 PM
            > > > > > > > > > Subject: [ydn-javascript] Re: Datatable row coloring
            > > > > > > > > >
            > > > > > > > > >
            > > > > > > > > > > Hi,
            > > > > > > > > > >
            > > > > > > > > > > I've the same problem here.
            > > > > > > > > > >
            > > > > > > > > > > With 2.5.0 version, you cannot use DataTable.getTrEl
            > > inside your
            > > > > > > > > > > custom cell format function. And the reason is: the
            > > current row
            > > > > > > > > > > wasn't appended to the table.
            > > > > > > > > > >
            > > > > > > > > > > If I'm not wrong, here is the flow:
            > > > > > > > > > >
            > > > > > > > > > > datatable-beta-debug.js
            > > > > > > > > > > +(10410) addRow : function(oData, index)
            > > > > > > > > > > +(7428) _createTrEl : function (oRecord)
            > > > > > > > > > > +(7449) _updateTrEl : function(elRow, oRecord)
            > > > > > > > > > > +(10820) formatCell : function(elCell, oRecord,
            > > oColumn)
            > > > > > > > > > > + [here you try to get the TR elmnt]
            > > > > > > > > > > +(10470) this._elTbody.appendChild(elNewTr);
            > > > > > > > > > >
            > > > > > > > > > > Maybe the correct way is change the row color in
            > > rowAddEvent.
            > > > > > > > > > >
            > > > > > > > > > > Cheers,
            > > > > > > > > > >
            > > > > > > > > > > fmachado
            > > > > > > > > > >
            > > > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud
            Limbourg"
            > > > > > > > > > > <arnaud.limbourg@> wrote:
            > > > > > > > > > >>
            > > > > > > > > > >> --- In ydn-javascript@yahoogroups.com, "Satyam"
            > > <satyam@> wrote:
            > > > > > > > > > >> >
            > > > > > > > > > >> > Try:
            > > > > > > > > > >> >
            > > > > > > > > > >> > var colorRows = function(elCell, oRecord, oColumn,
            > > oData) {
            > > > > > > > > > >> > var tr = this.getTrEl(elCell);
            > > > > > > > > > >> > YAHOO.util.Dom.addClass(tr, 'myclass');
            > > > > > > > > > >> > }
            > > > > > > > > > >> >
            > > > > > > > > > >> > What you did should work. Since it doesn't and if
            > > the above
            > > > > > > > does,
            > > > > > > > > > >> please
            > > > > > > > > > >> > file a bug report on SourceForge, I haven't seen
            > > anything that
            > > > > > > > > would
            > > > > > > > > > >> > indicate that what you did is no longer valid. The
            > > above,
            > > > > > > > > though, is
            > > > > > > > > > >> > faster.
            > > > > > > > > > >> >
            > > > > > > > > > >> > Satyam
            > > > > > > > > > >>
            > > > > > > > > > >> No luck. I'll file a bug because using
            > > DataSource.sendRequest()
            > > > > > > > makes
            > > > > > > > > > >> the formatting work as expected.
            > > > > > > > > > >>
            > > > > > > > > > >> I was not able to track this down.
            > > > > > > > > > >>
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > > Yahoo! Groups Links
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > > > --
            > > > > > > > > > > No virus found in this incoming message.
            > > > > > > > > > > Checked by AVG Free Edition.
            > > > > > > > > > > Version: 7.5.516 / Virus Database: 269.21.5/1314 -
            > > Release Date:
            > > > > > > > > > > 05/03/2008 18:38
            > > > > > > > > > >
            > > > > > > > > > >
            > > > > > > > > >
            > > > > > > > >
            > > > > > > >
            > > > > > >
            > > > > >
            > > > >
            > > >
            > >
            >
          • traderashish
            Thanks, initEvent worked. Ashish ... ... traderashish@ ... ... speaking. ... was a ... oColumn, ... and if ... valid. The
            Message 5 of 24 , May 2, 2008
            • 0 Attachment
              Thanks, initEvent worked.

              Ashish

              --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@...> wrote:
              >
              > For remote DataSources, try subscribing to both the renderEvent and
              > the initEvent.
              >
              > Luke
              >
              >
              > --- In ydn-javascript@yahoogroups.com, "traderashish"
              > <traderashish@> wrote:
              > >
              > > Hi Luke,
              > >
              > > I think in my case renderEvent is not firing. The data table displays
              > > but no class is marked. even though marksRecs has the row.
              > > on click row click event is firing. I was earlier on 2.5.0 and just
              > > upgraded to 2.5.1 and with no luck
              > >
              > > I have defined all the 2.5.1 source files specified on the yui data
              > > table page,
              > >
              > >
              > >
              > > here is code,
              > >
              > > YAHOO.util.Event.onDOMReady(function () {
              > >
              > > var Ev = YAHOO.util.Event,
              > > Dom = YAHOO.util.Dom,
              > > DS = YAHOO.util.DataSource,
              > > 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);
              > > }
              > > }
              > > cell.innerHTML = data;
              > > };
              > >
              > >
              > >
              > > var myColumnDefs = [
              > > {key:"id", label:"Case Id", sortable:true},
              > >
              > > {key:"status",label:"Status",formatter:"mark",sortable:true},
              > > ];
              > >
              > > this.myDataSource = new
              > > YAHOO.util.DataSource("http://127.0.0.1:8000/viewallcases?");
              > > this.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
              > > this.myDataSource.responseSchema = {
              > > resultsList: "items",
              > > fields:
              > > [{key:"id",parser:YAHOO.util.DataSource.parseNumber},"status"]};
              > >
              > > // Function to add the color class to rows
              > > this.updateMarks = function () {
              > > alert("in update marks");
              > >
              > > // Clear mark class off all rows
              > > Dom.removeClass(
              > > Dom.getElementsByClassName('mark','tr',
              > > this.myDataTable.getTbodyEl()),
              > > 'mark');
              > >
              > > // Apply mark class to identified rows
              > > for (var recKey in markRecs) {
              > >
              > > Dom.addClass(this.myDataTable.getTrEl(markRecs[recKey]),'mark');
              > > }
              > > };
              > >
              > >
              > > this.myDataTable = new
              > > YAHOO.widget.DataTable("sort", myColumnDefs,
              > > this.myDataSource);
              > > this.updateMarks();
              > > this.myDataTable.subscribe('renderEvent',
              > > this.updateMarks);
              > > this.myDataTable.subscribe('rowClickEvent',
              > > this.updateMarks);
              > >
              > >
              > >
              > >
              > >
              > > });
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > > --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@> wrote:
              > > >
              > > > Ashish,
              > > >
              > > > I threw together this example
              > > >
              > <http://yuiblog.com/sandbox/yui/v251/examples/datatable/row_color.html>
              > > > page for you (and all). The row isn't available to the
              > formatters, but
              > > > the record is and can be cached for manipulating the rows at a later
              > > > point (from a renderEvent listener).
              > > >
              > > > Hope this helps,
              > > > Luke
              > > >
              > > > --- In ydn-javascript@yahoogroups.com, "traderashish"
              <traderashish@>
              > > > wrote:
              > > > >
              > > > > Submitted enhancement request.
              > > > > Does not look like anyone has been figure out solution to this.
              > > > >
              > > > >
              > > > > --- In ydn-javascript@yahoogroups.com, "traderashish"
              traderashish@
              > > > wrote:
              > > > > >
              > > > > > Reposting last time, to find if anyone has example of how to
              > change
              > > > color of datatable
              > > > > row
              > > > > > based on the value in a column for that row.
              > > > > >
              > > > > > Ashish
              > > > > >
              > > > > > --- In ydn-javascript@yahoogroups.com, "traderashish"
              > > > <traderashish@> wrote:
              > > > > > >
              > > > > > > If some one got this to work, can you please post some
              > sample code
              > > > on how to do it.
              > > > > > >
              > > > > > >
              > > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@>
              wrote:
              > > > > > > >
              > > > > > > > I guess another way to put it is how to access the table row
              > > > during
              > > > > > > > the initial setup (another question is how I can get the
              > row ID
              > > > during
              > > > > > > > the same request - but this would be taken care of if I
              > knew the
              > > > > > > > former :) )
              > > > > > > >
              > > > > > > > Robert
              > > > > > > >
              > > > > > > >
              > > > > > > >
              > > > > > > > --- In ydn-javascript@yahoogroups.com, "Robert" <robert@>
              > wrote:
              > > > > > > > >
              > > > > > > > > How can you change the color of a row on the initial table
              > > > load? it
              > > > > > > > > seems rowAddEvent isn't being called until after the first
              > > > population.
              > > > > > > > >
              > > > > > > > > Robert
              > > > > > > > >
              > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud Limbourg"
              > > > > > > > > <arnaud.limbourg@> wrote:
              > > > > > > > > >
              > > > > > > > > > Thanks for the info.
              > > > > > > > > >
              > > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Satyam"
              <satyam@>
              > > > wrote:
              > > > > > > > > > >
              > > > > > > > > > > You got it right, I'm outdated ... generally
              speaking.
              > > > This has
              > > > > > > > > > changed
              > > > > > > > > > > since 2.4.1 when the cell was added to the row,
              > which had
              > > > already
              > > > > > > > > > been added
              > > > > > > > > > > to the table before formatCell was called. This is
              > not the
              > > > case now
              > > > > > > > > > in 2.5.0
              > > > > > > > > > > but can't complain about it because nobody said it
              was a
              > > > supported
              > > > > > > > > > > interface.
              > > > > > > > > > >
              > > > > > > > > > > You are right as well about using rowAddEvent,
              > everything
              > > > is
              > > > > > > > > settled by
              > > > > > > > > > > then.
              > > > > > > > > > >
              > > > > > > > > > > Thanks for the update, I'll keep it in mind.
              > > > > > > > > > >
              > > > > > > > > > > Satyam
              > > > > > > > > > >
              > > > > > > > > > > ----- Original Message -----
              > > > > > > > > > > From: "Fernando Machado" <fm@>
              > > > > > > > > > > To: ydn-javascript@yahoogroups.com
              > > > > > > > > > > Sent: Thursday, March 06, 2008 9:53 PM
              > > > > > > > > > > Subject: [ydn-javascript] Re: Datatable row coloring
              > > > > > > > > > >
              > > > > > > > > > >
              > > > > > > > > > > > Hi,
              > > > > > > > > > > >
              > > > > > > > > > > > I've the same problem here.
              > > > > > > > > > > >
              > > > > > > > > > > > With 2.5.0 version, you cannot use DataTable.getTrEl
              > > > inside your
              > > > > > > > > > > > custom cell format function. And the reason is: the
              > > > current row
              > > > > > > > > > > > wasn't appended to the table.
              > > > > > > > > > > >
              > > > > > > > > > > > If I'm not wrong, here is the flow:
              > > > > > > > > > > >
              > > > > > > > > > > > datatable-beta-debug.js
              > > > > > > > > > > > +(10410) addRow : function(oData, index)
              > > > > > > > > > > > +(7428) _createTrEl : function (oRecord)
              > > > > > > > > > > > +(7449) _updateTrEl : function(elRow, oRecord)
              > > > > > > > > > > > +(10820) formatCell : function(elCell, oRecord,
              > > > oColumn)
              > > > > > > > > > > > + [here you try to get the TR elmnt]
              > > > > > > > > > > > +(10470) this._elTbody.appendChild(elNewTr);
              > > > > > > > > > > >
              > > > > > > > > > > > Maybe the correct way is change the row color in
              > > > rowAddEvent.
              > > > > > > > > > > >
              > > > > > > > > > > > Cheers,
              > > > > > > > > > > >
              > > > > > > > > > > > fmachado
              > > > > > > > > > > >
              > > > > > > > > > > > --- In ydn-javascript@yahoogroups.com, "Arnaud
              > Limbourg"
              > > > > > > > > > > > <arnaud.limbourg@> wrote:
              > > > > > > > > > > >>
              > > > > > > > > > > >> --- In ydn-javascript@yahoogroups.com, "Satyam"
              > > > <satyam@> wrote:
              > > > > > > > > > > >> >
              > > > > > > > > > > >> > Try:
              > > > > > > > > > > >> >
              > > > > > > > > > > >> > var colorRows = function(elCell, oRecord,
              oColumn,
              > > > oData) {
              > > > > > > > > > > >> > var tr = this.getTrEl(elCell);
              > > > > > > > > > > >> > YAHOO.util.Dom.addClass(tr, 'myclass');
              > > > > > > > > > > >> > }
              > > > > > > > > > > >> >
              > > > > > > > > > > >> > What you did should work. Since it doesn't
              and if
              > > > the above
              > > > > > > > > does,
              > > > > > > > > > > >> please
              > > > > > > > > > > >> > file a bug report on SourceForge, I haven't seen
              > > > anything that
              > > > > > > > > > would
              > > > > > > > > > > >> > indicate that what you did is no longer
              valid. The
              > > > above,
              > > > > > > > > > though, is
              > > > > > > > > > > >> > faster.
              > > > > > > > > > > >> >
              > > > > > > > > > > >> > Satyam
              > > > > > > > > > > >>
              > > > > > > > > > > >> No luck. I'll file a bug because using
              > > > DataSource.sendRequest()
              > > > > > > > > makes
              > > > > > > > > > > >> the formatting work as expected.
              > > > > > > > > > > >>
              > > > > > > > > > > >> I was not able to track this down.
              > > > > > > > > > > >>
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > > Yahoo! Groups Links
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > > > --
              > > > > > > > > > > > No virus found in this incoming message.
              > > > > > > > > > > > Checked by AVG Free Edition.
              > > > > > > > > > > > Version: 7.5.516 / Virus Database: 269.21.5/1314 -
              > > > Release Date:
              > > > > > > > > > > > 05/03/2008 18:38
              > > > > > > > > > > >
              > > > > > > > > > > >
              > > > > > > > > > >
              > > > > > > > > >
              > > > > > > > >
              > > > > > > >
              > > > > > >
              > > > > >
              > > > >
              > > >
              > >
              >
            • rashmeep2000
              Hi Luke, This is my piece of code for coloring rows on rendering datatable. YAHOO.util.Event.onDOMReady(function () { var markRecs = {} var myColumnDefs=[
              Message 6 of 24 , May 26, 2008
              • 0 Attachment
                Hi Luke,
                This is my piece of code for coloring rows on rendering datatable.
                YAHOO.util.Event.onDOMReady(function () {
                var markRecs = {}

                var myColumnDefs=[
                //CAREFUL:donot change the label
                being used in identifying undo or delete.

                {key:'id',label:'delete',formatter:function(elCellLiner,
                oRecord, oColumn, oData) {
                elCellLiner.innerHTML = '<img
                src="/kcm/images/common/delete-page.gif" title="delete row" />';
                elCellLiner.style.cursor = 'pointer';
                }},
                //CAREFUL:donot change the label
                being used in identifying undo or delete.

                {key:'editStatus',label:'undo',formatter:function (elCellLiner,
                oRecord, oColumn, oData){
                var datamy =
                oRecord.getData('editStatus');
                }},

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

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

                // Apply mark class to identified rows
                for (var recKey in markRecs) {
                Dom.addClass(myDataTable.getTrEl(markRecs
                [recKey]),'mark');
                }
                };

                // Set row colors initially
                updateMarks();

                // Add the class to the rows on renderEvent
                myDataTable.subscribe('renderEvent',updateMarks);
                myDataTable.subscribe('initEvent',updateMarks);

                But, nothing seems to happen, not sure where i am making mistake.
                Also i want to define 2 different colors, red and green for deleted
                and added rows, can u throw light on this.

                thanks,looking forward for ur reply.
              • Satyam
                If you are borrowing the code from: http://yuiblog.com/sandbox/yui/v251/examples/datatable/row_color.html The array markRecs is meant to be populated by the
                Message 7 of 24 , May 26, 2008
                • 0 Attachment
                  If you are borrowing the code from:

                  http://yuiblog.com/sandbox/yui/v251/examples/datatable/row_color.html

                  The array markRecs is meant to be populated by the formatter function for
                  records that meet some condition. If markRecs is empty, nothing will be
                  highlighted.

                  However, it seems you mean to have an editStatus column, which probably
                  would hold the values that would determine whether the row is pained green
                  or red. Then, function updateMarks would have to loop through all the
                  records checking this field and color the row accordingly:

                  var updateMarks = function () {
                  var rec, row, len = myDataTable.getRecordSet().getLength();
                  for (var i = 0;i < len; i++) {
                  rec = myDataTable.getRecord(i);
                  row = myDataTable.getTrEl(rec);

                  // just in case any coloring remains from a previous sort
                  YAHOO.util.Dom.removeClass(row,'added');
                  YAHOO.util.Dom.removeClass(row,'deleted');

                  switch (rec.getData('editStatus')) {
                  case 1: // lets assume this means 'added'
                  YAHOO.util.Dom.addClass(row,'added');
                  break;
                  case 2: // lets assume this means 'deleted'
                  YAHOO.util.Dom.addClass(row,'deleted');
                  break;
                  }
                  }
                  };

                  Or something like that ....

                  Just in case, in http://www.satyam.com.ar/yui/2.5.0/assortedControls.html
                  you can see an example of how to handle button and image clicks.

                  Satyam




                  ----- Original Message -----
                  From: "rashmeep2000" <RPrasad2@...>
                  To: <ydn-javascript@yahoogroups.com>
                  Sent: Monday, May 26, 2008 2:27 PM
                  Subject: [ydn-javascript] Re: Datatable row coloring


                  > Hi Luke,
                  > This is my piece of code for coloring rows on rendering datatable.
                  > YAHOO.util.Event.onDOMReady(function () {
                  > var markRecs = {}
                  >
                  > var myColumnDefs=[
                  > //CAREFUL:donot change the label
                  > being used in identifying undo or delete.
                  >
                  > {key:'id',label:'delete',formatter:function(elCellLiner,
                  > oRecord, oColumn, oData) {
                  > elCellLiner.innerHTML = '<img
                  > src="/kcm/images/common/delete-page.gif" title="delete row" />';
                  > elCellLiner.style.cursor = 'pointer';
                  > }},
                  > //CAREFUL:donot change the label
                  > being used in identifying undo or delete.
                  >
                  > {key:'editStatus',label:'undo',formatter:function (elCellLiner,
                  > oRecord, oColumn, oData){
                  > var datamy =
                  > oRecord.getData('editStatus');
                  > }},
                  >
                  > // Function to add the color class to rows
                  > var updateMarks = function () {
                  > alert("in update marks");
                  >
                  > // Clear mark class off all rows
                  > Dom.removeClass(
                  > Dom.getElementsByClassName('mark','tr',
                  > myDataTable.getTbodyEl()),
                  > 'mark');
                  >
                  > // Apply mark class to identified rows
                  > for (var recKey in markRecs) {
                  > Dom.addClass(myDataTable.getTrEl(markRecs
                  > [recKey]),'mark');
                  > }
                  > };
                  >
                  > // Set row colors initially
                  > updateMarks();
                  >
                  > // Add the class to the rows on renderEvent
                  > myDataTable.subscribe('renderEvent',updateMarks);
                  > myDataTable.subscribe('initEvent',updateMarks);
                  >
                  > But, nothing seems to happen, not sure where i am making mistake.
                  > Also i want to define 2 different colors, red and green for deleted
                  > and added rows, can u throw light on this.
                  >
                  > thanks,looking forward for ur reply.
                  >
                  >
                  >
                  > ------------------------------------
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >


                  --------------------------------------------------------------------------------



                  No virus found in this incoming message.
                  Checked by AVG.
                  Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008
                  18:49
                • Rashmi Y. Prasad
                  Hi Satyam, This is fabulous example, which works perfectly fine..Thanks a ton for this code.i also tried disabling the deleted row/record.......have tried
                  Message 8 of 24 , May 26, 2008
                  • 0 Attachment

                    Hi Satyam,

                    This is fabulous example, which works perfectly fine..Thanks a ton for this code.i also tried disabling the deleted row/record…….have tried column..but not able to find one for row….can u pls. suggest on this….thanks in advance.

                     


                    From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                    Sent: Monday, May 26, 2008 8:16 PM
                    To: ydn-javascript@yahoogroups.com
                    Subject: Re: [ydn-javascript] Re: Datatable row coloring

                     

                    If you are borrowing the code from:

                    http://yuiblog. com/sandbox/ yui/v251/ examples/ datatable/ row_color. html

                    The array markRecs is meant to be populated by the formatter function for
                    records that meet some condition. If markRecs is empty, nothing will be
                    highlighted.

                    However, it seems you mean to have an editStatus column, which probably
                    would hold the values that would determine whether the row is pained green
                    or red. Then, function updateMarks would have to loop through all the
                    records checking this field and color the row accordingly:

                    var updateMarks = function () {
                    var rec, row, len = myDataTable. getRecordSet( ).getLength( );
                    for (var i = 0;i < len; i++) {
                    rec = myDataTable. getRecord( i);
                    row = myDataTable. getTrEl(rec) ;

                    // just in case any coloring remains from a previous sort
                    YAHOO.util.Dom. removeClass( row,'added' );
                    YAHOO.util.Dom. removeClass( row,'deleted' );

                    switch (rec.getData( 'editStatus' )) {
                    case 1: // lets assume this means 'added'
                    YAHOO.util.Dom. addClass( row,'added' );
                    break;
                    case 2: // lets assume this means 'deleted'
                    YAHOO.util.Dom. addClass( row,'deleted' );
                    break;
                    }
                    }
                    };

                    Or something like that ....

                    Just in case, in http://www.satyam. com.ar/yui/ 2.5.0/assortedCo ntrols.html
                    you can see an example of how to handle button and image clicks.

                    Satyam

                    ----- Original Message -----
                    From: "rashmeep2000" <RPrasad2@ketera. com>
                    To: <ydn-javascript@ yahoogroups. com>
                    Sent: Monday, May 26, 2008 2:27 PM
                    Subject: [ydn-javascript] Re: Datatable row coloring

                    > Hi Luke,
                    > This is my piece of code for coloring rows on rendering datatable.
                    > YAHOO.util.Event. onDOMReady( function () {
                    > var markRecs = {}
                    >
                    > var myColumnDefs= [
                    > //CAREFUL:donot change the label
                    > being used in identifying undo or delete.
                    >
                    > {key:'id',label: 'delete', formatter: function( elCellLiner,
                    > oRecord, oColumn, oData) {
                    > elCellLiner. innerHTML = '<img
                    > src="/kcm/images/ common/delete- page.gif" title="delete row" />';
                    > elCellLiner. style.cursor = 'pointer';
                    > }},
                    > //CAREFUL:donot change the label
                    > being used in identifying undo or delete.
                    >
                    > {key:'editStatus' ,label:'undo' ,formatter: function (elCellLiner,
                    > oRecord, oColumn, oData){
                    > var datamy =
                    > oRecord.getData( 'editStatus' );
                    > }},
                    >
                    > // Function to add the color class to rows
                    > var updateMarks = function () {
                    > alert("in update marks");
                    >
                    > // Clear mark class off all rows
                    > Dom.removeClass(
                    > Dom.getElementsByCl assName(' mark','tr' ,
                    > myDataTable. getTbodyEl( )),
                    > 'mark');
                    >
                    > // Apply mark class to identified rows
                    > for (var recKey in markRecs) {
                    > Dom.addClass( myDataTable. getTrEl(markRecs
                    > [recKey]),'mark' );
                    > }
                    > };
                    >
                    > // Set row colors initially
                    > updateMarks( );
                    >
                    > // Add the class to the rows on renderEvent
                    > myDataTable. subscribe( 'renderEvent' ,updateMarks) ;
                    > myDataTable. subscribe( 'initEvent' ,updateMarks) ;
                    >
                    > But, nothing seems to happen, not sure where i am making mistake.
                    > Also i want to define 2 different colors, red and green for deleted
                    > and added rows, can u throw light on this.
                    >
                    > thanks,looking forward for ur reply.
                    >
                    >
                    >
                    > ------------ --------- --------- ------
                    >
                    > Yahoo! Groups Links
                    >
                    >
                    >

                    ------------ --------- --------- --------- --------- --------- -

                    No virus found in this incoming message.
                    Checked by AVG.
                    Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008
                    18:49

                  • Satyam
                    Sorry, I m not sure what the question is, you are going a little too fast for me. Satyam ... From: Rashmi Y. Prasad To: ydn-javascript@yahoogroups.com Sent:
                    Message 9 of 24 , May 26, 2008
                    • 0 Attachment
                      Sorry, I'm not sure what the question is, you are going a little too fast for me.
                       
                      Satyam
                       
                      ----- Original Message -----
                      Sent: Monday, May 26, 2008 5:55 PM
                      Subject: RE: [ydn-javascript] Re: Datatable row coloring

                      Hi Satyam,

                      This is fabulous example, which works perfectly fine..Thanks a ton for this code.i also tried disabling the deleted row/record…….have tried column..but not able to find one for row….can u pls. suggest on this….thanks in advance.

                       


                      From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                      Sent: Monday, May 26, 2008 8:16 PM
                      To: ydn-javascript@yahoogroups.com
                      Subject: Re: [ydn-javascript] Re: Datatable row coloring

                       

                      If you are borrowing the code from:

                      http://yuiblog. com/sandbox/ yui/v251/ examples/ datatable/ row_color. html

                      The array markRecs is meant to be populated by the formatter function for
                      records that meet some condition. If markRecs is empty, nothing will be
                      highlighted.

                      However, it seems you mean to have an editStatus column, which probably
                      would hold the values that would determine whether the row is pained green
                      or red. Then, function updateMarks would have to loop through all the
                      records checking this field and color the row accordingly:

                      var updateMarks = function () {
                      var rec, row, len = myDataTable. getRecordSet( ).getLength( );
                      for (var i = 0;i < len; i++) {
                      rec = myDataTable. getRecord( i);
                      row = myDataTable. getTrEl(rec) ;

                      // just in case any coloring remains from a previous sort
                      YAHOO.util.Dom. removeClass( row,'added' );
                      YAHOO.util.Dom. removeClass( row,'deleted' );

                      switch (rec.getData( 'editStatus' )) {
                      case 1: // lets assume this means 'added'
                      YAHOO.util.Dom. addClass( row,'added' );
                      break;
                      case 2: // lets assume this means 'deleted'
                      YAHOO.util.Dom. addClass( row,'deleted' );
                      break;
                      }
                      }
                      };

                      Or something like that ....

                      Just in case, in http://www.satyam. com.ar/yui/ 2.5.0/assortedCo ntrols.html
                      you can see an example of how to handle button and image clicks.

                      Satyam

                      ----- Original Message -----
                      From: "rashmeep2000" <RPrasad2@ketera. com>
                      To: <ydn-javascript@ yahoogroups. com>
                      Sent: Monday, May 26, 2008 2:27 PM
                      Subject: [ydn-javascript] Re: Datatable row coloring

                      > Hi Luke,
                      > This is my piece of code for coloring rows on rendering datatable.
                      > YAHOO.util.Event. onDOMReady( function () {
                      > var markRecs = {}
                      >
                      > var myColumnDefs= [
                      > //CAREFUL:donot change the label
                      > being used in identifying undo or delete.
                      >
                      > {key:'id',label: 'delete', formatter: function( elCellLiner,
                      > oRecord, oColumn, oData) {
                      > elCellLiner. innerHTML = '<img
                      > src="/kcm/images/ common/delete- page.gif" title="delete row" />';
                      > elCellLiner. style.cursor = 'pointer';
                      > }},
                      > //CAREFUL:donot change the label
                      > being used in identifying undo or delete.
                      >
                      > {key:'editStatus' ,label:'undo' ,formatter: function (elCellLiner,
                      > oRecord, oColumn, oData){
                      > var datamy =
                      > oRecord.getData( 'editStatus' );
                      > }},
                      >
                      > // Function to add the color class to rows
                      > var updateMarks = function () {
                      > alert("in update marks");
                      >
                      > // Clear mark class off all rows
                      > Dom.removeClass(
                      > Dom.getElementsByCl assName(' mark','tr' ,
                      > myDataTable. getTbodyEl( )),
                      > 'mark');
                      >
                      > // Apply mark class to identified rows
                      > for (var recKey in markRecs) {
                      > Dom.addClass( myDataTable. getTrEl(markRecs
                      > [recKey]),'mark' );
                      > }
                      > };
                      >
                      > // Set row colors initially
                      > updateMarks( );
                      >
                      > // Add the class to the rows on renderEvent
                      > myDataTable. subscribe( 'renderEvent' ,updateMarks) ;
                      > myDataTable. subscribe( 'initEvent' ,updateMarks) ;
                      >
                      > But, nothing seems to happen, not sure where i am making mistake.
                      > Also i want to define 2 different colors, red and green for deleted
                      > and added rows, can u throw light on this.
                      >
                      > thanks,looking forward for ur reply.
                      >
                      >
                      >
                      > ------------ --------- --------- ------
                      >
                      > Yahoo! Groups Links
                      >
                      >
                      >

                      ------------ --------- --------- --------- --------- --------- -

                      No virus found in this incoming message.
                      Checked by AVG.
                      Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008
                      18:49



                      No virus found in this incoming message.
                      Checked by AVG.
                      Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008 18:49
                    • Rashmi Y. Prasad
                      When a particular row/record is found to be deleted(which I decide based on a flag(editStatus)), I have to make the complete row non editable in the datatable.
                      Message 10 of 24 , May 26, 2008
                      • 0 Attachment

                        When a particular row/record is found to be deleted(which I decide based on a flag(editStatus)), I have to make the complete row non editable in the datatable. Can u pls. suggest for this..thanks.

                         


                        From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                        Sent: Monday, May 26, 2008 9:45 PM
                        To: ydn-javascript@yahoogroups.com
                        Subject: Re: [ydn-javascript] Re: Datatable row coloring

                         

                        Sorry, I'm not sure what the question is, you are going a little too fast for me.

                         

                        Satyam

                         

                        ----- Original Message -----

                        Sent: Monday, May 26, 2008 5:55 PM

                        Subject: RE: [ydn-javascript] Re: Datatable row coloring

                         

                        Hi Satyam,

                        This is fabulous example, which works perfectly fine..Thanks a ton for this code.i also tried disabling the deleted row/record…….have tried column..but not able to find one for row….can u pls. suggest on this….thanks in advance.

                         


                        From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                        Sent: Monday, May 26, 2008 8:16 PM
                        To: ydn-javascript@ yahoogroups. com
                        Subject: Re: [ydn-javascript] Re: Datatable row coloring

                         

                        If you are borrowing the code from:

                        http://yuiblog. com/sandbox/ yui/v251/ examples/ datatable/ row_color. html

                        The array markRecs is meant to be populated by the formatter function for
                        records that meet some condition. If markRecs is empty, nothing will be
                        highlighted.

                        However, it seems you mean to have an editStatus column, which probably
                        would hold the values that would determine whether the row is pained green
                        or red. Then, function updateMarks would have to loop through all the
                        records checking this field and color the row accordingly:

                        var updateMarks = function () {
                        var rec, row, len = myDataTable. getRecordSet( ).getLength( );
                        for (var i = 0;i < len; i++) {
                        rec = myDataTable. getRecord( i);
                        row = myDataTable. getTrEl(rec) ;

                        // just in case any coloring remains from a previous sort
                        YAHOO.util.Dom. removeClass( row,'added' );
                        YAHOO.util.Dom. removeClass( row,'deleted' );

                        switch (rec.getData( 'editStatus' )) {
                        case 1: // lets assume this means 'added'
                        YAHOO.util.Dom. addClass( row,'added' );
                        break;
                        case 2: // lets assume this means 'deleted'
                        YAHOO.util.Dom. addClass( row,'deleted' );
                        break;
                        }
                        }
                        };

                        Or something like that ....

                        Just in case, in http://www.satyam. com.ar/yui/ 2.5.0/assortedCo ntrols.html
                        you can see an example of how to handle button and image clicks.

                        Satyam

                        ----- Original Message -----
                        From: "rashmeep2000" <RPrasad2@ketera. com>
                        To: <ydn-javascript@ yahoogroups. com>
                        Sent: Monday, May 26, 2008 2:27 PM
                        Subject: [ydn-javascript] Re: Datatable row coloring

                        > Hi Luke,
                        > This is my piece of code for coloring rows on rendering datatable.
                        > YAHOO.util.Event. onDOMReady( function () {
                        > var markRecs = {}
                        >
                        > var myColumnDefs= [
                        > //CAREFUL:donot change the label
                        > being used in identifying undo or delete.
                        >
                        > {key:'id',label: 'delete', formatter: function( elCellLiner,
                        > oRecord, oColumn, oData) {
                        > elCellLiner. innerHTML = '<img
                        > src="/kcm/images/ common/delete- page.gif" title="delete row" />';
                        > elCellLiner. style.cursor = 'pointer';
                        > }},
                        > //CAREFUL:donot change the label
                        > being used in identifying undo or delete.
                        >
                        > {key:'editStatus' ,label:'undo' ,formatter: function (elCellLiner,
                        > oRecord, oColumn, oData){
                        > var datamy =
                        > oRecord.getData( 'editStatus' );
                        > }},
                        >
                        > // Function to add the color class to rows
                        > var updateMarks = function () {
                        > alert("in update marks");
                        >
                        > // Clear mark class off all rows
                        > Dom.removeClass(
                        > Dom.getElementsByCl assName(' mark','tr' ,
                        > myDataTable. getTbodyEl( )),
                        > 'mark');
                        >
                        > // Apply mark class to identified rows
                        > for (var recKey in markRecs) {
                        > Dom.addClass( myDataTable. getTrEl(markRecs
                        > [recKey]),'mark' );
                        > }
                        > };
                        >
                        > // Set row colors initially
                        > updateMarks( );
                        >
                        > // Add the class to the rows on renderEvent
                        > myDataTable. subscribe( 'renderEvent' ,updateMarks) ;
                        > myDataTable. subscribe( 'initEvent' ,updateMarks) ;
                        >
                        > But, nothing seems to happen, not sure where i am making mistake.
                        > Also i want to define 2 different colors, red and green for deleted
                        > and added rows, can u throw light on this.
                        >
                        > thanks,looking forward for ur reply.
                        >
                        >
                        >
                        > ------------ --------- --------- ------
                        >
                        > Yahoo! Groups Links
                        >
                        >
                        >

                        ------------ --------- --------- --------- --------- --------- -

                        No virus found in this incoming message.
                        Checked by AVG.
                        Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008
                        18:49

                        size=2 width="100%" align=center>


                        No virus found in this incoming message.
                        Checked by AVG.
                        Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008 18:49

                      • Satyam
                        Third time you are asking basically the same thing: http://tech.groups.yahoo.com/group/ydn-javascript/message/31226 Conditions in an if() statement can be
                        Message 11 of 24 , May 26, 2008
                        • 0 Attachment
                          Third time you are asking basically the same thing:
                           
                           
                          Conditions in an if() statement can be quite complex, there is nothing else to it, just put more conditions in it.
                           
                          Satyam
                           
                          ----- Original Message -----
                          Sent: Monday, May 26, 2008 6:33 PM
                          Subject: RE: [ydn-javascript] Re: Datatable row coloring

                          When a particular row/record is found to be deleted(which I decide based on a flag(editStatus)), I have to make the complete row non editable in the datatable. Can u pls. suggest for this..thanks.

                           


                          From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                          Sent: Monday, May 26, 2008 9:45 PM
                          To: ydn-javascript@yahoogroups.com
                          Subject: Re: [ydn-javascript] Re: Datatable row coloring

                           

                          Sorry, I'm not sure what the question is, you are going a little too fast for me.

                           

                          Satyam

                           

                          ----- Original Message -----

                          Sent: Monday, May 26, 2008 5:55 PM

                          Subject: RE: [ydn-javascript] Re: Datatable row coloring

                           

                          Hi Satyam,

                          This is fabulous example, which works perfectly fine..Thanks a ton for this code.i also tried disabling the deleted row/record…….have tried column..but not able to find one for row….can u pls. suggest on this….thanks in advance.

                           


                          From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                          Sent: Monday, May 26, 2008 8:16 PM
                          To: ydn-javascript@ yahoogroups. com
                          Subject: Re: [ydn-javascript] Re: Datatable row coloring

                           

                          If you are borrowing the code from:

                          http://yuiblog. com/sandbox/ yui/v251/ examples/ datatable/ row_color. html

                          The array markRecs is meant to be populated by the formatter function for
                          records that meet some condition. If markRecs is empty, nothing will be
                          highlighted.

                          However, it seems you mean to have an editStatus column, which probably
                          would hold the values that would determine whether the row is pained green
                          or red. Then, function updateMarks would have to loop through all the
                          records checking this field and color the row accordingly:

                          var updateMarks = function () {
                          var rec, row, len = myDataTable. getRecordSet( ).getLength( );
                          for (var i = 0;i < len; i++) {
                          rec = myDataTable. getRecord( i);
                          row = myDataTable. getTrEl(rec) ;

                          // just in case any coloring remains from a previous sort
                          YAHOO.util.Dom. removeClass( row,'added' );
                          YAHOO.util.Dom. removeClass( row,'deleted' );

                          switch (rec.getData( 'editStatus' )) {
                          case 1: // lets assume this means 'added'
                          YAHOO.util.Dom. addClass( row,'added' );
                          break;
                          case 2: // lets assume this means 'deleted'
                          YAHOO.util.Dom. addClass( row,'deleted' );
                          break;
                          }
                          }
                          };

                          Or something like that ....

                          Just in case, in http://www.satyam. com.ar/yui/ 2.5.0/assortedCo ntrols.html
                          you can see an example of how to handle button and image clicks.

                          Satyam

                          ----- Original Message -----
                          From: "rashmeep2000" <RPrasad2@ketera. com>
                          To: <ydn-javascript@ yahoogroups. com>
                          Sent: Monday, May 26, 2008 2:27 PM
                          Subject: [ydn-javascript] Re: Datatable row coloring

                          > Hi Luke,
                          > This is my piece of code for coloring rows on rendering datatable.
                          > YAHOO.util.Event. onDOMReady( function () {
                          > var markRecs = {}
                          >
                          > var myColumnDefs= [
                          > //CAREFUL:donot change the label
                          > being used in identifying undo or delete.
                          >
                          > {key:'id',label: 'delete', formatter: function( elCellLiner,
                          > oRecord, oColumn, oData) {
                          > elCellLiner. innerHTML = '<img
                          > src="/kcm/images/ common/delete- page.gif" title="delete row" />';
                          > elCellLiner. style.cursor = 'pointer';
                          > }},
                          > //CAREFUL:donot change the label
                          > being used in identifying undo or delete.
                          >
                          > {key:'editStatus' ,label:'undo' ,formatter: function (elCellLiner,
                          > oRecord, oColumn, oData){
                          > var datamy =
                          > oRecord.getData( 'editStatus' );
                          > }},
                          >
                          > // Function to add the color class to rows
                          > var updateMarks = function () {
                          > alert("in update marks");
                          >
                          > // Clear mark class off all rows
                          > Dom.removeClass(
                          > Dom.getElementsByCl assName(' mark','tr' ,
                          > myDataTable. getTbodyEl( )),
                          > 'mark');
                          >
                          > // Apply mark class to identified rows
                          > for (var recKey in markRecs) {
                          > Dom.addClass( myDataTable. getTrEl(markRecs
                          > [recKey]),'mark' );
                          > }
                          > };
                          >
                          > // Set row colors initially
                          > updateMarks( );
                          >
                          > // Add the class to the rows on renderEvent
                          > myDataTable. subscribe( 'renderEvent' ,updateMarks) ;
                          > myDataTable. subscribe( 'initEvent' ,updateMarks) ;
                          >
                          > But, nothing seems to happen, not sure where i am making mistake.
                          > Also i want to define 2 different colors, red and green for deleted
                          > and added rows, can u throw light on this.
                          >
                          > thanks,looking forward for ur reply.
                          >
                          >
                          >
                          > ------------ --------- --------- ------
                          >
                          > Yahoo! Groups Links
                          >
                          >
                          >

                          ------------ --------- --------- --------- --------- --------- -

                          No virus found in this incoming message.
                          Checked by AVG.
                          Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008
                          18:49



                          No virus found in this incoming message.
                          Checked by AVG.
                          Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 25/05/2008 18:49
                        Your message has been successfully submitted and would be delivered to recipients shortly.