I have the following questions regarding the CGridView:
1) I wish to combine 'Category' and 'Subcategory' models in my view. I have created the two separate CGridViews, however the CButtonColumn references the 'Category' controller actions by default - how can I make it reference the Subcategory controller actions?
2) How can I add a heading to the column above the CButtonColumn, for example 'Actions'.
3) How can I customize the headings of the existing columns?
Thanks.
Page 1 of 1
CGridView questions
#2
Posted 02 March 2010 - 07:24 AM
1. http://www.yiiframew...uttonUrl-detail
By default, it means the 'update' action of the current controller.
2. http://www.yiiframew...n#header-detail
3. Same as 2.
By default, it means the 'update' action of the current controller.
2. http://www.yiiframew...n#header-detail
3. Same as 2.
#3
Posted 02 March 2010 - 07:39 AM
Cheers qiang. I did this:
'updateButtonUrl'=>"array('subcategory/update')",
So how can I now append the id= parameter to each of these URLs?
'updateButtonUrl'=>"array('subcategory/update')",
So how can I now append the id= parameter to each of these URLs?
#4
Posted 02 March 2010 - 07:50 AM
Did you read the property API? It is a PHP expression and you can use $data to refer to the row of data. So you can write something like:
'Yii::app()->controller->createUrl("subcategory/update",array("id"=>$data->id))';
'Yii::app()->controller->createUrl("subcategory/update",array("id"=>$data->id))';
#5
Posted 02 March 2010 - 10:48 AM
I got one last question for someone to answer. In my table I got a field that stores a multi-value data as such:
Value 1|Value 2|Value 3
I need to display this data in my CGridView, but delimited by a comma.
I tried this:
'value'=>'implode(", ", $data->parent_cats)',
But it just gives a blank cell. Anyone able to advise?
Value 1|Value 2|Value 3
I need to display this data in my CGridView, but delimited by a comma.
I tried this:
'value'=>'implode(", ", $data->parent_cats)',
But it just gives a blank cell. Anyone able to advise?
#6
Posted 03 March 2010 - 06:42 AM
GSTAR, on 02 March 2010 - 10:48 AM, said:
...
Value 1|Value 2|Value 3
...
'value'=>'implode(", ", $data->parent_cats)',
Value 1|Value 2|Value 3
...
'value'=>'implode(", ", $data->parent_cats)',
You should first "explode" the values!
eg.
'value'=>'implode(", ", explode("|",$data->parent_cats))',
Find more about me.... btw. Do you know your WAN IP?
Share this topic:
Page 1 of 1

Help












