so, I want to make a new button in my CGridView. This is up & down arrow buttons which is will be used for sorting my articles. I've read a lot of how to make this kind of buttons. I already read the wiki of how to use this CGridView button also in this link.
And now I have this in my view :
array(
'header' => 'Action',
'class' => 'CButtonColumn',
'template' => '{moveup}{movedown}{view}{delete}',
'htmlOptions' => array('style' => 'width: 68px'),
'buttons' => array
(
'moveup' => array
(
'label' => 'Move Up',
'imageUrl' => Yii::app()->request->baseUrl . '/images/move_up.png',
'url' => 'Yii::app()->createUrl("KB/moveup", array("id"=>$data->KBID))',
'visible' => '$data->KBORDER == KB::model()->getMax()',
),
'movedown' => array
(
'label' => 'Move Down',
'imageUrl' => Yii::app()->request->baseUrl . '/images/move_down.png',
'url' => 'Yii::app()->createUrl("KB/movedown", array("id"=>$data->KBID))',
'visible' => '$data->KBORDER == KB::model()->getMin()',
),
),
),
and this one in my model :
public function getMax(){
$sql = 'SELECT MAX(KBORDER) FROM KB';
$max = Yii::app()->db->createCommand($sql);
$max->queryAll();
return $max;
}
public function getMin(){
$sql = 'SELECT MIN(KBORDER) FROM KB';
$min = Yii::app()->db->createCommand($sql);
$min->queryAll();
return $min;
}
All that codes running just fine. except for the visibility. I want to make the up button become invisible when it has the highest value of KBORDER or when it position is in the 1st place. And for the down button, it supposed to be invisible too when it has the lowest value of KBORDER or when it position is in the last place. but, when I put that code in my 'visible', all the buttons are invicible. so my question is, how to make my request happen?
thanks in advance