Skip to content

Commit

Permalink
move gridColumnTemp to traits
Browse files Browse the repository at this point in the history
  • Loading branch information
PutraSudaryanto committed Jul 16, 2018
1 parent 42b3760 commit 62030c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions GridViewTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* filterYesNo
* quickAction
* filterDatepicker
* gridColumnTemp
*
*/

Expand Down Expand Up @@ -142,4 +143,23 @@ public function filterDatepicker($model, $attribute, $filter=true)
return CHtml::activeDateField($model, $attribute, $options);
}
}

/**
* gridColumnTemp
*
* @return array
*/
public function gridColumnTemp()
{
$gridColumn = Yii::app()->getRequest()->getParam('GridColumn');
$columnTemp = array();
if($gridColumn) {
foreach($gridColumn as $key => $val) {
if($gridColumn[$key] == 1)
$columnTemp[] = $key;
}
}

return $columnTemp;
}
}
4 changes: 2 additions & 2 deletions system/OActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function getGridColumn($columns=null)
}
return $this->defaultColumns;
}

foreach($columns as $val) {
if(!in_array($val, $this->gridForbiddenColumn) && !in_array($val, $this->defaultColumns)) {
if(array_key_exists($val, $this->templateColumns) && !in_array($val, $this->defaultColumns)) {
$col = $this->getTemplateColumn($val);
if($col != null)
$this->defaultColumns[] = $col;
Expand Down

0 comments on commit 62030c1

Please sign in to comment.