Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

cgridview filter relation improvement #2007 #2008

Open
wants to merge 5 commits into from

3 participants

João Parreira Carsten Brandt Mark
João Parreira

#2007

Improvement of filter in cgridview

CHANGELOG
@@ -3,6 +3,7 @@
Version 1.1.14 work in progress
-------------------------------
+- Enh #2007: Improvement of filter with relation in cgridview (n3okill)
Mark
Ragazzo added a note

put this in the Enh. block under the your issue order (2007).

João Parreira
n3okill added a note

done, didn't have noticed the block's, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Carsten Brandt
Collaborator

@n3okill please revert all the whitespace and code style changes, the file had yii code style before your changes. Also it makes it easier to see what you where actually changing when you do not change codestyle and whitespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 18, 2013
  1. João Parreira
  2. João Parreira

    CHANGELOG UPDATE

    n3okill authored
  3. João Parreira

    CHANGELOG update

    n3okill authored
  4. João Parreira

    CHANGELOG update

    n3okill authored
  5. João Parreira

    Changes in formating style

    n3okill authored
This page is out of date. Refresh to see the latest.
Showing with 29 additions and 5 deletions.
  1. +1 −0  CHANGELOG
  2. +28 −5 framework/zii/widgets/grid/CDataColumn.php
1  CHANGELOG
View
@@ -11,6 +11,7 @@ Version 1.1.14 work in progress
- Bug #1942: CActiveForm client/ajax validation will now remove error class from server side validation (mdomba)
- Bug #1984: CDbMigration: fix of undeclared variable usage in debug information in dropPrimaryKey (papulovskiy)
- Enh #1847: Added COutputCache::varyByLanguage to generate separate cache for different languages (Obramko)
+- Enh #2007: Improvement of filter with relation in cgridview (n3okill)
- Chg #645: CDbConnection now throws CDbException when failed to open DB connection instead of failing with a warning (kidol, eirikhm, samdark, cebe)
- Chg #1891: Changed order of methods in models generated by Gii and yiic, added better description of search method (hijarian, samdark)
- New #1785: Added CPasswordHelper (tom--)
33 framework/zii/widgets/grid/CDataColumn.php
View
@@ -89,12 +89,35 @@ protected function renderFilterCellContent()
{
if(is_string($this->filter))
echo $this->filter;
- elseif($this->filter!==false && $this->grid->filter!==null && $this->name!==null && strpos($this->name,'.')===false)
+ elseif($this->filter !== false && $this->grid->filter !== null && $this->name !== null)
{
- if(is_array($this->filter))
- echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id'=>false,'prompt'=>''));
- elseif($this->filter===null)
- echo CHtml::activeTextField($this->grid->filter, $this->name, array('id'=>false));
+ if(strpos($this->name,'.') === false)
+ {
+ if(is_array($this->filter))
+ echo CHtml::activeDropDownList($this->grid->filter,$this->name,$this->filter,array('id' => false,'prompt' => ''));
+ elseif($this->filter === null)
+ echo CHtml::activeTextField($this->grid->filter,$this->name,array('id' => false));
+ }
+ else
+ {
+ $segs = explode('.',$this->name);
+ $name = array_pop($segs);
+ $model = $this->grid->filter;
+ foreach($segs as $seg)
+ {
+ if(isset($model->$seg))
+ $model = $model->$seg;
+ else
+ parent::renderFilterCellContent();
+ }
+ if(is_array($this->filter))
+ {
+ echo CHtml::activeDropDownList($model,$name,$this->filter,array('id' => false,'prompt' => ''));
+ }elseif($this->filter === null)
+ {
+ echo CHtml::activeTextField($model,$name,array('id' => false));
+ }
+ }
}
else
parent::renderFilterCellContent();
Something went wrong with that request. Please try again.