IncrementOffset(); throw $objExc; } // Record Method Callbacks $this->strSetEditPanelMethod = $strSetEditPanelMethod; $this->strCloseEditPanelMethod = $strCloseEditPanelMethod; // Setup the Template $this->Template = 'ProductListPanel.tpl.php'; // Instantiate the Meta DataGrid $this->dtgProducts = new ProductDataGrid($this); // Style the DataGrid (if desired) $this->dtgProducts->CssClass = 'datagrid'; $this->dtgProducts->AlternateRowStyle->CssClass = 'alternate'; // Add Pagination (if desired) $this->dtgProducts->Paginator = new QPaginator($this->dtgProducts); $this->dtgProducts->ItemsPerPage = 8; // Use the MetaDataGrid functionality to add Columns for this datagrid // Create an Edit Column $this->pxyEdit = new QControlProxy($this); $this->pxyEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'pxyEdit_Click')); $this->dtgProducts->MetaAddEditProxyColumn($this->pxyEdit, 'Edit', 'Edit'); // Create the Other Columns (note that you can use strings for product's properties, or you // can traverse down QQN::product() to display fields that are down the hierarchy) $this->dtgProducts->MetaAddColumn('Id'); $this->dtgProducts->MetaAddColumn(QQN::Product()->Manufacturer); $this->dtgProducts->MetaAddColumn(QQN::Product()->Supplier); $this->dtgProducts->MetaAddColumn('CreationDate'); $this->dtgProducts->MetaAddColumn('Name'); $this->dtgProducts->MetaAddColumn('Model'); $this->dtgProducts->MetaAddColumn('ShortDescription'); $this->dtgProducts->MetaAddColumn('LongDescription'); $this->dtgProducts->MetaAddColumn('Msrp'); $this->dtgProducts->MetaAddColumn('WholesalePrice'); $this->dtgProducts->MetaAddColumn('RetailPrice'); $this->dtgProducts->MetaAddColumn('Cost'); $this->dtgProducts->MetaAddColumn('Weight'); $this->dtgProducts->MetaAddColumn('Height'); $this->dtgProducts->MetaAddColumn('Width'); $this->dtgProducts->MetaAddColumn('Depth'); $this->dtgProducts->MetaAddColumn('IsVirtual'); $this->dtgProducts->MetaAddTypeColumn('TypeId', 'ProductType'); $this->dtgProducts->MetaAddTypeColumn('StatusId', 'ProductStatusType'); $this->dtgProducts->MetaAddColumn('ViewCount'); // Setup the Create New button $this->btnCreateNew = new QButton($this); $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Product'); $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click')); } public function pxyEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objEditPanel = new ProductEditPanel($this, $this->strCloseEditPanelMethod, $strParameterArray[0]); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->$strMethodName($objEditPanel); } public function btnCreateNew_Click($strFormId, $strControlId, $strParameter) { $objEditPanel = new ProductEditPanel($this, $this->strCloseEditPanelMethod, null); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->$strMethodName($objEditPanel); } } ?>