TTable displays an HTML table on a Web page. A table may have {@link setCaption Caption}, whose alignment is specified via {@link setCaptionAlign CaptionAlign}. The table cellpadding and cellspacing are specified via {@link setCellPadding CellPadding} and {@link setCellSpacing CellSpacing} properties, respectively. The {@link setGridLines GridLines} specifies how the table should display its borders. The horizontal alignment of the table content can be specified via {@link setHorizontalAlign HorizontalAlign}, and {@link setBackImageUrl BackImageUrl} can assign a background image to the table. A TTable maintains a list of {@link TTableRow} controls in its {@link getRows Rows} property. Each {@link TTableRow} represents an HTML table row. To populate the table {@link getRows Rows}, you may either use control template or dynamically create {@link TTableRow} in code. In template, do as follows to create the table rows and cells, The above can also be accomplished in code as follows, $table=new TTable; $row=new TTableRow; $cell=new TTableCell; $cell->Text="content"; $row->Cells->add($cell); $cell=new TTableCell; $cell->Text="content"; $row->Cells->add($cell); $table->Rows->add($row); $row=new TTableRow; $cell=new TTableCell; $cell->Text="content"; $row->Cells->add($cell); $cell=new TTableCell; $cell->Text="content"; $row->Cells->add($cell); $table->Rows->add($row);
С версии: 3.0
Автор: Qiang Xue (qiang.xue@gmail.com)
Наследование: extends TWebControl
Пример #1
0
 /**
  * Renders the repeated items.
  * @param THtmlWriter writer for the rendering purpose
  * @param IRepeatInfoUser repeat information user
  */
 public function renderRepeater($writer, IRepeatInfoUser $user)
 {
     if ($this->_repeatLayout === TRepeatLayout::Table) {
         $control = new TTable();
         if ($this->_caption !== '') {
             $control->setCaption($this->_caption);
             $control->setCaptionAlign($this->_captionAlign);
         }
     } else {
         if ($this->_repeatLayout === TRepeatLayout::Raw) {
             $this->renderRawContents($writer, $user);
             return;
         } else {
             $control = new TWebControl();
         }
     }
     $control->setID($user->getClientID());
     $control->copyBaseAttributes($user);
     if ($user->getHasStyle()) {
         $control->getStyle()->copyFrom($user->getStyle());
     }
     $control->renderBeginTag($writer);
     $writer->writeLine();
     if ($this->_repeatDirection === TRepeatDirection::Vertical) {
         $this->renderVerticalContents($writer, $user);
     } else {
         $this->renderHorizontalContents($writer, $user);
     }
     $control->renderEndTag($writer);
 }