Ejemplo n.º 1
0
 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 QDataGridRow($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 = QDataGridBase::ParseHtml($this->strRowActionParameterHtml, $this, null, $objObject);
         $strToReturn = $objRow->GetHtml($strColumnsHtml);
         QApplication::ExecuteJavaScript($objRow->GetActionAttributes());
     } 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;
 }