Prado\Web\UI\WebControls\TListBox::addAttributesToRender PHP Method

addAttributesToRender() protected method

This method overrides the parent implementation with additional list box specific attributes.
protected addAttributesToRender ( $writer )
    protected function addAttributesToRender($writer)
    {
        $rows = $this->getRows();
        $writer->addAttribute('size', "{$rows}");
        if ($this->getSelectionMode() === TListSelectionMode::Multiple) {
            $writer->addAttribute('name', $this->getUniqueID() . '[]');
        } else {
            $writer->addAttribute('name', $this->getUniqueID());
        }
        parent::addAttributesToRender($writer);
    }

Usage Example

Example #1
0
 /**
  * Ensure that the ID attribute is rendered and registers the javascript code
  * for initializing the active control.
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     $writer->addAttribute('id', $this->getClientID());
     if ($this->getAutoPostBack()) {
         $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
     }
 }