protected function doRenderGrid(Grid $Grid, $pageMode, $templatePath, $customParams = array()) { $Rows = array(); while ($Grid->GetDataset()->Next()) { $rowValues = $Grid->GetDataset()->GetCurrentFieldValues(); $Rows[] = Q::ToArray(Q::Select($Grid->GetPrintColumns(), Q::L('$c => $_1->RenderViewColumn($c, $_2)', $this, $rowValues))); } $template = $Grid->GetPage()->GetCustomTemplate(PagePart::Grid, $pageMode, $templatePath, $customParams); $this->DisplayTemplate($template, array('Grid' => $Grid), array_merge($customParams, array('Columns' => $Grid->GetPrintColumns(), 'Rows' => $Rows))); }
function RenderGrid(Grid $Grid) { $Rows = array(); $Grid->GetDataset()->Open(); while ($Grid->GetDataset()->Next()) { $rowValues = $Grid->GetDataset()->GetCurrentFieldValues(); $Rows[] = Q::ToArray(Q::Select($Grid->GetPrintColumns(), Q::L('$c => $_1->RenderViewColumn($c, $_2)', $this, $rowValues))); } $totals = array(); if ($Grid->HasTotals()) { $totalValues = $Grid->GetTotalValues(); foreach ($Grid->GetPrintColumns() as $column) { $totals[] = $column->GetTotalPresentationData(ArrayUtils::GetArrayValueDef($totalValues, $column->GetName(), null)); } } $this->DisplayTemplate('print/grid.tpl', array('Grid' => $Grid), array('Columns' => $Grid->GetPrintColumns(), 'Rows' => $Rows, 'Totals' => $totals)); }