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

Re: i want change cell color...

Expand Messages
  • santini.alberto
    Hello. ... Using a DataTable widget (http://developer.yahoo.com/yui/datatable/), I change the background of the cell in the formatter of the column. For
    Message 1 of 3 , Sep 2, 2008
    • 0 Attachment
      Hello.

      --- In ydn-javascript@yahoogroups.com, "magefister" <magefister@...>
      wrote:
      >
      > i want change cell color...

      Using a DataTable widget (http://developer.yahoo.com/yui/datatable/),
      I change the background of the cell in the formatter of the column.

      For instance,

      var myColumnDefs = [
      {
      ...
      key: "min",
      label: "Min %",
      width: 48,
      formatter: function (el, oRecord, oColumn, oData) {
      if (isNaN(oData) || oData < 0) {
      oData = 0;
      }
      if (oData > 100) {
      oData = 100;
      }
      el.innerHTML = YAHOO.util.Number.format(oData, {
      prefix: "",
      decimalPlaces: 2,
      decimalSeparator: ".",
      thousandsSeparator: ","
      });
      el.align = "right";

      if (oData > 0) {
      el.style.backgroundColor = "#FFA0A0";
      } else {
      el.style.backgroundColor = "#FFFFFF";
      }
      },
      ...


      Regards,
      Alberto
    • Satyam
      If you want to change the color of the whole cell, notice that each column has an className assigned to it based on the yui-dt-col- prefix followed by the
      Message 2 of 3 , Sep 2, 2008
      • 0 Attachment
        If you want to change the color of the whole cell, notice that each
        column has an className assigned to it based on the "yui-dt-col-" prefix
        followed by the column key, in your case, "yui-dt-col-abc4". Simply
        define a CSS style for that selector and it will happen. The row above
        has styles yui-dt-odd and yui-dt-even so that with the appropriate
        selectors you can change the color of a column and still provide two
        different shadings for alternate rows.

        Satyam


        magefister wrote:
        > i want change cell color...
        > for example..
        >
        > there are 4 cells.
        >
        > {key:"abc"},
        > {key:"abc2"},
        > {key:"abc3"},
        > {key:"abc4"}
        >
        > and i want chage color of "abc4" cell..
        >
        > how can i do for it??
        >
        >
        >
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg.com
        > Version: 8.0.169 / Virus Database: 270.6.14/1645 - Release Date: 01/09/2008 7:19
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.