Andrewww
(Andrescellini)
October 9, 2013, 2:54am
1
I am having some trouble to add stars rating inside a detailview . what i want to do is replace a number whit a stars imgs.
this was my attempt, but the error is "Fatal error: Cannot use object of type CStarRating as array";
<?php $this->widget('bootstrap.widgets.TbDetailView',array(
'data'=>$model,
'attributes'=>array(
'IdContacto',
$this->widget('CStarRating',array(
'name'=>'probabilidadRating',
'maxRating'=>5,
'minRating'=>1,
'value'=>$model->Probabilidad,
'readOnly'=>true,
)),
'Cuit',
'Email',
),
)); ?>
thks!
zaccaria
(Matteo Falsitta)
October 9, 2013, 6:22am
3
As the error says, the configuration should be an array with name, value.
Also the value has to be a string, not an object, so you have to set the third parameter of widget function to true in order to have the html returned.
In a word:
<?php $this->widget('bootstrap.widgets.TbDetailView',array(
'data'=>$model,
'attributes'=>array(
'IdContacto',
array(
'name'=>'Probabilidad',
'value'=>$this->widget('CStarRating',
array(
'name'=>'probabilidadRating',
'maxRating'=>5,
'minRating'=>1,
'value'=>$model->Probabilidad,
'readOnly'=>true,
),
true
),
),
'Cuit',
'Email',
),
)); ?>
Andrewww
(Andrescellini)
October 9, 2013, 9:46pm
4
zaccaria:
As the error says, the configuration should be an array with name, value.
Also the value has to be a string, not an object, so you have to set the third parameter of widget function to true in order to have the html returned.
In a word:
<?php $this->widget('bootstrap.widgets.TbDetailView',array(
'data'=>$model,
'attributes'=>array(
'IdContacto',
array(
'name'=>'Probabilidad',
'value'=>$this->widget('CStarRating',
array(
'name'=>'probabilidadRating',
'maxRating'=>5,
'minRating'=>1,
'value'=>$model->Probabilidad,
'readOnly'=>true,
),
true
),
),
'Cuit',
'Email',
),
)); ?>
Amazing man, that last parameter solve my problem. any widget have this last param?