/** * QDataGridLegacy::__construct() * * @param mixed $objParentObject The Datagrid's parent * @param string $strControlId Control ID * * @throws QCallerException * @return \QDataGridLegacy */ public function __construct($objParentObject, $strControlId = null) { try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // For example... let's default the CssClass to datagrid $this->CssClass = 'datagrid'; }
/** * @param $objObject * * @return string HTML of the row * @throws Exception * @throws QCallerException */ protected function GetDataGridRowHtml($objObject) { // Get the Default Style $objStyle = $this->objRowStyle; // Iterate through the Columns $strColumnsHtml = ''; foreach ($this->objColumnArray as $objColumn) { try { $strHtml = $this->ParseColumnHtml($objColumn, $objObject); if ($objColumn->HtmlEntities) { $strHtml = QApplication::HtmlEntities($strHtml); } // For IE if (QApplication::IsBrowser(QBrowserType::InternetExplorer) && $strHtml == '') { $strHtml = ' '; } } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } $strColumnsHtml .= sprintf(" <td %s>%s</td>\r\n", $objColumn->GetAttributes(), $strHtml); } // Apply AlternateRowStyle (if applicable) if ($this->intCurrentRowIndex % 2 == 1) { $objStyle = $objStyle->ApplyOverride($this->objAlternateRowStyle); } // Apply any Style Override (if applicable) if (is_array($this->objOverrideRowStyleArray) && array_key_exists($this->intCurrentRowIndex, $this->objOverrideRowStyleArray) && !is_null($this->objOverrideRowStyleArray[$this->intCurrentRowIndex])) { $objStyle = $objStyle->ApplyOverride($this->objOverrideRowStyleArray[$this->intCurrentRowIndex]); } // Make the event string $strTrId = sprintf("%srow%s", $this->strControlId, $this->intCurrentRowIndex); $numEvents = count($this->objRowEventArray); if ($numEvents > 0) { $this->RemoveChildControl($strTrId, true); $objRow = new QDataGridLegacyRow($this, $strTrId); // add all the row actions to this proxy for ($i = 0; $i < $numEvents; ++$i) { $objRow->AddAction($this->objRowEventArray[$i], $this->objRowActionArray[$i]); } $objRow->Style = $objStyle; // parse the action parameter $objRow->ActionParameter = QDataGridLegacyBase::ParseHtml($this->strRowActionParameterHtml, $this, null, $objObject); $strToReturn = $objRow->GetHtml($strColumnsHtml); QApplication::ExecuteJavaScript($objRow->RenderActionScripts()); } else { // If there are no events, don't create any row controls' // Finish up $strToReturn = sprintf('<tr id="%s" %s>%s</tr>', $strTrId, $objStyle->GetAttributes(), $strColumnsHtml); } $this->intCurrentRowIndex++; return $strToReturn; }