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

37041Re: i want change cell color...

Expand Messages
  • santini.alberto
    Sep 2, 2008
      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
    • Show all 3 messages in this topic