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

Datatable row coloring

Expand Messages
  • Arnaud Limbourg
    Hello all, I ve upgraded from 2.4.1 to 2.5.0 and I have an issue with the datatable. I have a custom formatter that add a class to a row depending on a
    Message 1 of 24 , Feb 27, 2008
      Hello all,

      I've upgraded from 2.4.1 to 2.5.0 and I have an issue with the
      datatable. I have a custom formatter that add a class to a row depending
      on a condition. This used to work fine under 2.4.1 but has a weird
      behaviour in 2.5.0.

      Upon first displaying the datatable the class is not added, getTrEl
      returns null. The datasource uses json and refresh the datatable with
      sendRequest and render adds the class properly.

      I'll show some code as I realise I may not be very clear in my
      explanation. I've modified the code

      <code>
      YAHOO.ns.mymod.ticket.listDataSource = new YAHOO.util.DataSource("url");
      YAHOO.ns.mymod.ticket.listDataSource.responseType =
      YAHOO.util.DataSource.TYPE_JSON;
      YAHOO.ns.mymod.ticket.listDataSource.connMethodPost = true;
      YAHOO.ns.mymod.listDataSource.connXhrMode = "queueRequests";
      YAHOO.ns.mymod.listDataSource.responseSchema = {
      resultsList: "ResultSet.Result",
      fields: [
      'id','created_on'
      ]
      };

      var colorRows = function(elCell, oRecord, oColumn, oData) {
      var tr = this.getTrEl(oRecord);
      YAHOO.util.Dom.addClass(tr, 'myclass');
      }

      var myColumnDefs = [
      {key: 'datetime_open', label:"Date", formatter: colorRows, sortable:
      true},
      ];

      var oConfigs = {
      paginator : new YAHOO.widget.Paginator({
      rowsPerPage : 100
      })
      ,
      initialRequest: 'url'
      };
      YAHOO.ns.mymod.listDataTable = new YAHOO.widget.DataTable("mydiv",
      myColumnDefs,
      YAHOO.ns.mymod.listDataSource, oConfigs);
      YAHOO.ns.mymod.listDataTable.subscribe("rowClickEvent",
      YAHOO.ns.mymod.selectFromList);
      YAHOO.ns.mymod.listDataTable.subscribe("rowMouseoverEvent",
      YAHOO.ns.mymod.listDataTable.onEventHighlightRow);
      YAHOO.ns.mymod.ticket.listDataTable.subscribe("rowMouseoutEvent",
      YAHOO.ns.mymod.listDataTable.onEventUnhighlightRow);
      YAHOO.ns.mymod.listDataTable.render();
      </code>
    • Satyam
      I m afraid that in trying to shorten the code for our benefit you have ruined a good part of it. What you show below won t work at all, not in 2.5, not in
      Message 2 of 24 , Feb 27, 2008
        I'm afraid that in trying to shorten the code for our benefit you have
        ruined a good part of it. What you show below won't work at all, not in
        2.5, not in 2.4.

        From your description, something I would check is how you have defined the
        selector for row style. Notice that in 2.5, there is an intermediate
        element in between the TD element of the cell and the actual data, what they
        call the 'liner' so now some styles defined as:

        .yui-skin-sam .yui-dt-table td.someStyle

        will not work any longer.

        First, the style for a table now is yui-dt, not yui-dt-table. Second, since
        there is that liner, the style you assign to the cell container goes to the
        'liner', not to the td element so now you would have to put a space in
        between the td and the .someStyle. Something like this would work now:

        .yui-skin-sam .yui-dt td .someStyle

        Satyam

        ----- Original Message -----
        From: "Arnaud Limbourg" <arnaud.limbourg@...>
        To: <ydn-javascript@yahoogroups.com>
        Sent: Wednesday, February 27, 2008 2:20 PM
        Subject: [ydn-javascript] Datatable row coloring


        > Hello all,
        >
        > I've upgraded from 2.4.1 to 2.5.0 and I have an issue with the
        > datatable. I have a custom formatter that add a class to a row depending
        > on a condition. This used to work fine under 2.4.1 but has a weird
        > behaviour in 2.5.0.
        >
        > Upon first displaying the datatable the class is not added, getTrEl
        > returns null. The datasource uses json and refresh the datatable with
        > sendRequest and render adds the class properly.
        >
        > I'll show some code as I realise I may not be very clear in my
        > explanation. I've modified the code
        >
        > <code>
        > YAHOO.ns.mymod.ticket.listDataSource = new YAHOO.util.DataSource("url");
        > YAHOO.ns.mymod.ticket.listDataSource.responseType =
        > YAHOO.util.DataSource.TYPE_JSON;
        > YAHOO.ns.mymod.ticket.listDataSource.connMethodPost = true;
        > YAHOO.ns.mymod.listDataSource.connXhrMode = "queueRequests";
        > YAHOO.ns.mymod.listDataSource.responseSchema = {
        > resultsList: "ResultSet.Result",
        > fields: [
        > 'id','created_on'
        > ]
        > };
        >
        > var colorRows = function(elCell, oRecord, oColumn, oData) {
        > var tr = this.getTrEl(oRecord);
        > YAHOO.util.Dom.addClass(tr, 'myclass');
        > }
        >
        > var myColumnDefs = [
        > {key: 'datetime_open', label:"Date", formatter: colorRows, sortable:
        > true},
        > ];
        >
        > var oConfigs = {
        > paginator : new YAHOO.widget.Paginator({
        > rowsPerPage : 100
        > })
        > ,
        > initialRequest: 'url'
        > };
        > YAHOO.ns.mymod.listDataTable = new YAHOO.widget.DataTable("mydiv",
        > myColumnDefs,
        > YAHOO.ns.mymod.listDataSource, oConfigs);
        > YAHOO.ns.mymod.listDataTable.subscribe("rowClickEvent",
        > YAHOO.ns.mymod.selectFromList);
        > YAHOO.ns.mymod.listDataTable.subscribe("rowMouseoverEvent",
        > YAHOO.ns.mymod.listDataTable.onEventHighlightRow);
        > YAHOO.ns.mymod.ticket.listDataTable.subscribe("rowMouseoutEvent",
        > YAHOO.ns.mymod.listDataTable.onEventUnhighlightRow);
        > YAHOO.ns.mymod.listDataTable.render();
        > </code>
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        > --
        > No virus found in this incoming message.
        > Checked by AVG Free Edition.
        > Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date:
        > 26/02/2008 19:50
        >
        >
      • Arnaud Limbourg
        Sorry about the shortening-went-awry. I checked the css selectors but the problem is that the class is not added as getTrEl returns null. Shouldn t the
        Message 3 of 24 , Feb 27, 2008
          Sorry about the shortening-went-awry. I checked the css selectors but
          the problem is that the class is not added as getTrEl returns null.

          Shouldn't the formatter work though ?

          var colorRows = function(elCell, oRecord, oColumn, oData) {
          var tr = this.getTrEl(oRecord);
          YAHOO.util.Dom.addClass(tr, 'myclass');
          }

          --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
          >
          > I'm afraid that in trying to shorten the code for our benefit you have
          > ruined a good part of it. What you show below won't work at all,
          not in
          > 2.5, not in 2.4.
          >
          > From your description, something I would check is how you have
          defined the
          > selector for row style. Notice that in 2.5, there is an intermediate
          > element in between the TD element of the cell and the actual data,
          what they
          > call the 'liner' so now some styles defined as:
          >
          > .yui-skin-sam .yui-dt-table td.someStyle
          >
          > will not work any longer.
          >
          > First, the style for a table now is yui-dt, not yui-dt-table.
          Second, since
          > there is that liner, the style you assign to the cell container goes
          to the
          > 'liner', not to the td element so now you would have to put a space in
          > between the td and the .someStyle. Something like this would work now:
          >
          > .yui-skin-sam .yui-dt td .someStyle
          >
          > Satyam
          >
          > ----- Original Message -----
          > From: "Arnaud Limbourg" <arnaud.limbourg@...>
          > To: <ydn-javascript@yahoogroups.com>
          > Sent: Wednesday, February 27, 2008 2:20 PM
          > Subject: [ydn-javascript] Datatable row coloring
          >
          >
          > > Hello all,
          > >
          > > I've upgraded from 2.4.1 to 2.5.0 and I have an issue with the
          > > datatable. I have a custom formatter that add a class to a row
          depending
          > > on a condition. This used to work fine under 2.4.1 but has a weird
          > > behaviour in 2.5.0.
          > >
          > > Upon first displaying the datatable the class is not added, getTrEl
          > > returns null. The datasource uses json and refresh the datatable with
          > > sendRequest and render adds the class properly.
          > >
          > > I'll show some code as I realise I may not be very clear in my
          > > explanation. I've modified the code
          > >
          > > <code>
          > > YAHOO.ns.mymod.ticket.listDataSource = new
          YAHOO.util.DataSource("url");
          > > YAHOO.ns.mymod.ticket.listDataSource.responseType =
          > > YAHOO.util.DataSource.TYPE_JSON;
          > > YAHOO.ns.mymod.ticket.listDataSource.connMethodPost = true;
          > > YAHOO.ns.mymod.listDataSource.connXhrMode = "queueRequests";
          > > YAHOO.ns.mymod.listDataSource.responseSchema = {
          > > resultsList: "ResultSet.Result",
          > > fields: [
          > > 'id','created_on'
          > > ]
          > > };
          > >
          > > var colorRows = function(elCell, oRecord, oColumn, oData) {
          > > var tr = this.getTrEl(oRecord);
          > > YAHOO.util.Dom.addClass(tr, 'myclass');
          > > }
          > >
          > > var myColumnDefs = [
          > > {key: 'datetime_open', label:"Date", formatter: colorRows,
          sortable:
          > > true},
          > > ];
          > >
          > > var oConfigs = {
          > > paginator : new YAHOO.widget.Paginator({
          > > rowsPerPage : 100
          > > })
          > > ,
          > > initialRequest: 'url'
          > > };
          > > YAHOO.ns.mymod.listDataTable = new YAHOO.widget.DataTable("mydiv",
          > > myColumnDefs,
          > > YAHOO.ns.mymod.listDataSource, oConfigs);
          > > YAHOO.ns.mymod.listDataTable.subscribe("rowClickEvent",
          > > YAHOO.ns.mymod.selectFromList);
          > > YAHOO.ns.mymod.listDataTable.subscribe("rowMouseoverEvent",
          > > YAHOO.ns.mymod.listDataTable.onEventHighlightRow);
          > > YAHOO.ns.mymod.ticket.listDataTable.subscribe("rowMouseoutEvent",
          > > YAHOO.ns.mymod.listDataTable.onEventUnhighlightRow);
          > > YAHOO.ns.mymod.listDataTable.render();
          > > </code>
          > >
          > >
          > >
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > > --
          > > No virus found in this incoming message.
          > > Checked by AVG Free Edition.
          > > Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date:
          > > 26/02/2008 19:50
          > >
          > >
          >
        • Satyam
          Try: var colorRows = function(elCell, oRecord, oColumn, oData) { var tr = this.getTrEl(elCell); YAHOO.util.Dom.addClass(tr, myclass ); } What you did should
          Message 4 of 24 , Feb 27, 2008
            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


            ----- Original Message -----
            From: "Arnaud Limbourg" <arnaud.limbourg@...>
            To: <ydn-javascript@yahoogroups.com>
            Sent: Wednesday, February 27, 2008 2:48 PM
            Subject: [ydn-javascript] Re: Datatable row coloring


            > Sorry about the shortening-went-awry. I checked the css selectors but
            > the problem is that the class is not added as getTrEl returns null.
            >
            > Shouldn't the formatter work though ?
            >
            > var colorRows = function(elCell, oRecord, oColumn, oData) {
            > var tr = this.getTrEl(oRecord);
            > YAHOO.util.Dom.addClass(tr, 'myclass');
            > }
            >
            > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
            >>
            >> I'm afraid that in trying to shorten the code for our benefit you have
            >> ruined a good part of it. What you show below won't work at all,
            > not in
            >> 2.5, not in 2.4.
            >>
            >> From your description, something I would check is how you have
            > defined the
            >> selector for row style. Notice that in 2.5, there is an intermediate
            >> element in between the TD element of the cell and the actual data,
            > what they
            >> call the 'liner' so now some styles defined as:
            >>
            >> .yui-skin-sam .yui-dt-table td.someStyle
            >>
            >> will not work any longer.
            >>
            >> First, the style for a table now is yui-dt, not yui-dt-table.
            > Second, since
            >> there is that liner, the style you assign to the cell container goes
            > to the
            >> 'liner', not to the td element so now you would have to put a space in
            >> between the td and the .someStyle. Something like this would work now:
            >>
            >> .yui-skin-sam .yui-dt td .someStyle
            >>
            >> Satyam
            >>
            >> ----- Original Message -----
            >> From: "Arnaud Limbourg" <arnaud.limbourg@...>
            >> To: <ydn-javascript@yahoogroups.com>
            >> Sent: Wednesday, February 27, 2008 2:20 PM
            >> Subject: [ydn-javascript] Datatable row coloring
            >>
            >>
            >> > Hello all,
            >> >
            >> > I've upgraded from 2.4.1 to 2.5.0 and I have an issue with the
            >> > datatable. I have a custom formatter that add a class to a row
            > depending
            >> > on a condition. This used to work fine under 2.4.1 but has a weird
            >> > behaviour in 2.5.0.
            >> >
            >> > Upon first displaying the datatable the class is not added, getTrEl
            >> > returns null. The datasource uses json and refresh the datatable with
            >> > sendRequest and render adds the class properly.
            >> >
            >> > I'll show some code as I realise I may not be very clear in my
            >> > explanation. I've modified the code
            >> >
            >> > <code>
            >> > YAHOO.ns.mymod.ticket.listDataSource = new
            > YAHOO.util.DataSource("url");
            >> > YAHOO.ns.mymod.ticket.listDataSource.responseType =
            >> > YAHOO.util.DataSource.TYPE_JSON;
            >> > YAHOO.ns.mymod.ticket.listDataSource.connMethodPost = true;
            >> > YAHOO.ns.mymod.listDataSource.connXhrMode = "queueRequests";
            >> > YAHOO.ns.mymod.listDataSource.responseSchema = {
            >> > resultsList: "ResultSet.Result",
            >> > fields: [
            >> > 'id','created_on'
            >> > ]
            >> > };
            >> >
            >> > var colorRows = function(elCell, oRecord, oColumn, oData) {
            >> > var tr = this.getTrEl(oRecord);
            >> > YAHOO.util.Dom.addClass(tr, 'myclass');
            >> > }
            >> >
            >> > var myColumnDefs = [
            >> > {key: 'datetime_open', label:"Date", formatter: colorRows,
            > sortable:
            >> > true},
            >> > ];
            >> >
            >> > var oConfigs = {
            >> > paginator : new YAHOO.widget.Paginator({
            >> > rowsPerPage : 100
            >> > })
            >> > ,
            >> > initialRequest: 'url'
            >> > };
            >> > YAHOO.ns.mymod.listDataTable = new YAHOO.widget.DataTable("mydiv",
            >> > myColumnDefs,
            >> > YAHOO.ns.mymod.listDataSource, oConfigs);
            >> > YAHOO.ns.mymod.listDataTable.subscribe("rowClickEvent",
            >> > YAHOO.ns.mymod.selectFromList);
            >> > YAHOO.ns.mymod.listDataTable.subscribe("rowMouseoverEvent",
            >> > YAHOO.ns.mymod.listDataTable.onEventHighlightRow);
            >> > YAHOO.ns.mymod.ticket.listDataTable.subscribe("rowMouseoutEvent",
            >> > YAHOO.ns.mymod.listDataTable.onEventUnhighlightRow);
            >> > YAHOO.ns.mymod.listDataTable.render();
            >> > </code>
            >> >
            >> >
            >> >
            >> >
            >> > Yahoo! Groups Links
            >> >
            >> >
            >> >
            >> >
            >> >
            >> > --
            >> > No virus found in this incoming message.
            >> > Checked by AVG Free Edition.
            >> > Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date:
            >> > 26/02/2008 19:50
            >> >
            >> >
            >>
            >
            >
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            > --
            > No virus found in this incoming message.
            > Checked by AVG Free Edition.
            > Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date:
            > 26/02/2008 19:50
            >
            >
          • Arnaud Limbourg
            ... please ... 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.
            Message 5 of 24 , Feb 27, 2008
              --- 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.
            • Fernando Machado
              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
              Message 6 of 24 , Mar 6, 2008
                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.
                >
              • Satyam
                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
                Message 7 of 24 , Mar 7, 2008
                  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
                  >
                  >
                • Arnaud Limbourg
                  Thanks for the info. ... changed ... been added ... in 2.5.0 ... would ... though, is
                  Message 8 of 24 , Mar 12, 2008
                    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
                    > >
                    > >
                    >
                  • Robert
                    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 ... settled
                    Message 9 of 24 , Mar 18, 2008
                      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
                      > > >
                      > > >
                      > >
                      >
                    • Robert
                      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 -
                      Message 10 of 24 , Mar 19, 2008
                        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
                        If some one got this to work, can you please post some sample code on how to do it.
                        Message 11 of 24 , Apr 25, 2008
                          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
                          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
                          Message 12 of 24 , Apr 28, 2008
                            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
                            Submitted enhancement request. Does not look like anyone has been figure out solution to this. ... row
                            Message 13 of 24 , Apr 28, 2008
                              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
                              Ashish, I threw together this example page for you (and all). The row isn t available
                              Message 14 of 24 , Apr 30, 2008
                                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 15 of 24 , May 1, 2008
                                  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 16 of 24 , May 1, 2008
                                    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 17 of 24 , May 2, 2008
                                      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 18 of 24 , May 2, 2008
                                        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 19 of 24 , May 26, 2008
                                          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 20 of 24 , May 26, 2008
                                            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 21 of 24 , May 26, 2008

                                              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 22 of 24 , May 26, 2008
                                                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 23 of 24 , May 26, 2008

                                                  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 24 of 24 , May 26, 2008
                                                    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.