Global.helma.Html.TableWriter.write (text, attr)
Write a table cell.

  • Parameter String:
    the table cell content as text
  • Parameter attr:
    an optional attributes holder for the td tag
Sourcecode in /home/hannes/helma/modules/helma/Html.js:
591:   this.write = function(text, attr) {
592:               // set up some variables
593:               var isHeaderRow = (this.writeHeader && this.written < this.ncols);
594:               var isNewRow = (this.written % this.ncols == 0);
595:               var isEvenRow = ((this.written / this.ncols) % 2 == 0);
596:               var isEvenCol = ((this.written % this.ncols) % 2 == 0);
597:               // write out table and table row tags
598:               if (this.written == 0) {
599:                   if (this.writeString)
600:                      res.push();
601:                  self.openTag("table", this.attr.table);
602:                  self.openTag("tr", this.attr.trHead);
603:              } else if (isNewRow) {
604:                  self.closeTag("tr");
605:                  if (isEvenRow)
606:                       self.openTag("tr", this.attr.trEven);
607:                  else
608:                       self.openTag("tr", this.attr.trOdd);
609:              }
610:              // get the attribute object for the table cell
611:              if (!attr) {
612:                  // no explicit attribute given
613:                  if (isEvenCol)
614:                      attr = isHeaderRow ? this.attr.thEven : this.attr.tdEven;
615:                  else
616:                      attr = isHeaderRow ? this.attr.thOdd : this.attr.tdOdd;
617:              }
618:              // write out table cell tag
619:              self.openTag(isHeaderRow ? "th" : "td", attr);
620:              // write out table cell contents
621:              if (text)
622:                  res.write(text);
623:              // close table cell
624:              self.closeTag(isHeaderRow ? "th" : "td");
625:              if (attr && !isNaN(attr.colspan))
626:                  this.written += attr.colspan;
627:              else
628:                  this.written += 1;
629:              return;
630:          }