public function SetFilteredDataGridColumnFilter(QDataGridLegacyColumn $col) { if ($this->_PrimaryKeyNode) { $objNode = $this->_PrimaryKeyNode; } else { $objNode = $this; } switch ($objNode->strType) { case QDatabaseFieldType::Bit: //List of true / false / any $col->FilterType = QFilterType::ListFilter; $col->FilterAddListItem("True", QQ::Equal($objNode, true)); $col->FilterAddListItem("False", QQ::Equal($objNode, false)); $col->FilterAddListItem("Set", QQ::IsNotNull($objNode)); $col->FilterAddListItem("Unset", QQ::IsNull($objNode)); break; case QDatabaseFieldType::Blob: case QDatabaseFieldType::Char: case QDatabaseFieldType::Time: case QDatabaseFieldType::VarChar: case QDatabaseFieldType::Date: case QDatabaseFieldType::DateTime: //LIKE $col->FilterType = QFilterType::TextFilter; $col->FilterPrefix = '%'; $col->FilterPostfix = '%'; $col->Filter = QQ::Like($objNode, null); break; case QDatabaseFieldType::Float: case QDatabaseFieldType::Integer: //EQUAL $col->FilterType = QFilterType::TextFilter; $col->Filter = QQ::Equal($objNode, null); break; case QType::Object: case QType::Resource: default: //this node points to a class, there's no way to know what to filter on $col->FilterType = QFilterType::None; $col->ClearFilter(); break; } }
/** * Override method to perform a property "Set" * This will set the property $strName to be $mixValue * * @param string $strName Name of the property to set * @param string $mixValue New value of the property * * @return mixed * @throws Exception|QCallerException */ public function __set($strName, $mixValue) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'PrimaryKey': /** * Sets the value for strPrimaryKey * @param integer $mixValue * @return string */ try { return $this->strPrimaryKey = QType::Cast($mixValue, QType::String); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } default: try { return parent::__set($strName, $mixValue); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * CreateControls used in the filter row and set their fiter values if available. * NOTE: this function, btnReset_Click and GetControlValue are the functions to override/change if you want to add new types * * @param string $strControlId id based on the column that the control is contained * @param QDataGridLegacyColumn $objColumn the QDataGridLegacyColumn that contains the filter data. * * @return QControl $control the input control used for filtering */ protected function CreateFilterControl($strControlId, QDataGridLegacyColumn $objColumn) { //show the current filter in the control $value = $objColumn->GetActiveFilterValue(); #region Create the control //create the appropriate kind of control $actionName = 'btnFilter_Click'; $ctlFilter = null; switch ($objColumn->FilterType) { default: case QFilterType::TextFilter: $ctlFilter = $this->filterTextBox_Create($strControlId, $objColumn->Name, $objColumn->FilterBoxSize, $value); break; case QFilterType::ListFilter: $ctlFilter = $this->filterListBox_Create($strControlId, $objColumn->Name, $objColumn->FilterList, $value); break; } #endregion if (null !== $ctlFilter) { //make sure hitting enter applies the filter if ($this->blnUseAjax) { $ctlFilter->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, $actionName, $this->objWaitIcon)); } else { $ctlFilter->AddAction(new QEnterKeyEvent(), new QServerControlAction($this, $actionName)); } $ctlFilter->AddAction(new QEnterKeyEvent(), new QTerminateAction()); } return $ctlFilter; }