/** * Create and setup QListBox lstDatagrid * @param string $strControlId optional ControlId to use * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return QListBox */ public function lstDatagrid_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstDatagrid = new QListBox($this->objParentObject, $strControlId); $this->lstDatagrid->Name = QApplication::Translate('Datagrid'); $this->lstDatagrid->Required = true; if (!$this->blnEditMode) { $this->lstDatagrid->AddItem(QApplication::Translate('- Select One -'), null); } // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objDatagridCursor = Datagrid::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objDatagrid = Datagrid::InstantiateCursor($objDatagridCursor)) { $objListItem = new QListItem($objDatagrid->__toString(), $objDatagrid->DatagridId); if ($this->objDatagridColumnPreference->Datagrid && $this->objDatagridColumnPreference->Datagrid->DatagridId == $objDatagrid->DatagridId) { $objListItem->Selected = true; } $this->lstDatagrid->AddItem($objListItem); } // Return the QListBox return $this->lstDatagrid; }