TTableCell displays a table cell on a Web page. Content of the table cell is specified by the {@link setText Text} property. If {@link setText Text} is empty, the body contents enclosed by the table cell component tag are rendered. Note, {@link setText Text} is not HTML-encoded when displayed. So make sure it does not contain dangerous characters. The horizontal and vertical alignments of the contents in the cell are specified via {@link setHorizontalAlign HorizontalAlign} and {@link setVerticalAlign VerticalAlign} properties, respectively. The colspan and rowspan of the cell are specified via {@link setColumnSpan ColumnSpan} and {@link setRowSpan RowSpan} properties. And the {@link setWrap Wrap} property indicates whether the contents in the cell should be wrapped.
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends TWebControl, implements Prado\IDataRenderer
Example #1
0
 /**
  * Adds attributes to renderer.
  * @param THtmlWriter the renderer
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     if (($scope = $this->getScope()) !== TTableHeaderScope::NotSet) {
         $writer->addAttribute('scope', $scope === TTableHeaderScope::Row ? 'row' : 'col');
     }
     if (($text = $this->getAbbreviatedText()) !== '') {
         $writer->addAttribute('abbr', $text);
     }
     if (($text = $this->getCategoryText()) !== '') {
         $writer->addAttribute('axis', $text);
     }
 }
Example #2
0
 /**
  * Renders and replaces the cell's content on the client-side. When render() is
  * called before the OnPreRender event, such as when render() is called during
  * a callback event handler, the rendering is defered until OnPreRender event
  * is raised.
  * @param THtmlWriter html writer
  */
 public function render($writer)
 {
     if ($this->getHasPreRendered()) {
         parent::render($writer);
         if ($this->getActiveControl()->canUpdateClientSide()) {
             $this->getPage()->getCallbackClient()->replaceContent($this, $writer);
         }
     } else {
         $this->getPage()->getAdapter()->registerControlToRender($this, $writer);
         // If we update a TActiveTableCell on callback, we shouldn't update all childs,
         // because the whole content will be replaced by the parent.
         if ($this->getHasControls()) {
             foreach ($this->findControlsByType('IActiveControl', false) as $control) {
                 $control->getActiveControl()->setEnableUpdate(false);
             }
         }
     }
 }