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

Re: [ydn-javascript] Re: datatable conditional formatting

Expand Messages
  • Satyam
    The examples declare the functions separately to make it easier to follow, introducing one concept at a time. I prefer to avoid jumping back and forth trying
    Message 1 of 6 , Nov 28, 2007
      The examples declare the functions separately to make it easier to follow,
      introducing one concept at a time. I prefer to avoid jumping back and forth
      trying to find what was defined where. Also, it is much better to avoid
      defining the style inline and certainly not with the font tag.

      {key:"po4p", label:"PO4-P", sortable:true, formatter:function(elCell,
      oRecord, oColumn, oData) {
      elCell.innerHTML = oData;
      if(oData < 100) YAHOO.util.Dom.addClass(elCell,'myHighlight');
      }},


      Satyam



      ----- Original Message -----
      From: "s_schwebs" <s_schwebs@...>
      To: <ydn-javascript@yahoogroups.com>
      Sent: Wednesday, November 28, 2007 7:23 PM
      Subject: [ydn-javascript] Re: datatable conditional formatting


      > Thank you. This worked excellently. For the record to change the
      > text color I used this function:
      >
      >
      > var forPhos = function(elCell, oRecord, oColumn, oData) {
      > var phos = oData;
      >
      > if(phos<100){
      > elCell.innerHTML = "<font color='#FF0066'>"+phos+"</color>";
      > }else{
      > elCell.innerHTML = phos;
      > }
      > };
      >
      > then in my column defs added:
      >
      > {key:"po4p", label:"PO4-P", sortable:true, formatter:forPhos},
      >
      > Seth
      >
      > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
      >>
      >> You can either assign a className property to a whole column
      > (probably not
      >> what you are looking for) or you can assign a formatter function to any
      >> column. The formatter function receives a reference to the cell,
      > the raw
      >> data to be displayed and the full record so you can even base the
      > formatting
      >> on the values of other cells in the same row.
      >>
      >> See:
      >> http://developer.yahoo.com/yui/datatable/#format
      >>
      >> Satyam
      >>
      >>
      >>
      >> ----- Original Message -----
      >> From: "s_schwebs" <s_schwebs@...>
      >> To: <ydn-javascript@yahoogroups.com>
      >> Sent: Tuesday, November 27, 2007 11:44 PM
      >> Subject: [ydn-javascript] datatable conditional formatting
      >>
      >>
      >> > Is there a means to create a conditional formatting effect with the
      >> > datatable? Something similar to excel(format->conditional
      > formatting).
      >> > Perhaps this is possible when defining the column defs?
      >> >
      >> > Thanks.
      >> >
      >> >
      >> >
      >> >
      >> > Yahoo! Groups Links
      >> >
      >> >
      >> >
      >> >
      >> >
      >> > --
      >> > No virus found in this incoming message.
      >> > Checked by AVG Free Edition.
      >> > Version: 7.5.503 / Virus Database: 269.16.8/1153 - Release Date:
      >> > 26/11/2007 21:08
      >> >
      >> >
      >>
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG Free Edition.
      > Version: 7.5.503 / Virus Database: 269.16.9/1155 - Release Date:
      > 27/11/2007 20:30
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.