gustgon
(Gustgon)
1
Pessoal, bom dia.
É o seguinte, quero colocar uma barra de progresso em uma coluna do GridView. Isso é possível ?
Eu já utilizo o YiiBooster normalmente. O meu problema é a sintaxe do campo Value da coluna do GridView. Segue abaixo a minha última tentativa:
array( 'name' => 'Pgtos',
'type' => 'raw',
// 'info', 'success' or 'danger'
'value'=> '$this->widget("bootstrap.widgets.TbProgress", array("type"=>"success", "percent"=>60), true)',
),
Ele me retorna o erro:
TbDataColumn and its behaviors do not have a method or closure named "widget".
Referência já pesquisada:
http://www.yiiframework.com/wiki/331/displaying-image-in-a-cgridview-column/
http://www.yiiframework.com/forum/index.php/topic/24974-how-to-call-a-widget-from-cgridview/
http://www.yiiframework.com/forum/index.php/topic/7035-how-to-use-a-widget-in-cgridview-column/
Obrigado !
Flavio
(Flavioleonelferreira)
2
Newerton
(Newerton Araujo)
3
Gustavo,
Tenta usar:
'value'=>'$this->grid->controller->widget("bootstrap.widgets.TbProgress", array("type"=>"success", "percent"=>60), true)',
gustgon
(Gustgon)
4
betelgeuse, valeu a dica !
Fiz assim:
array( 'name' => 'Recebido',
'header'=>'Recebido',
'type' => 'raw',
'value' => array($this, 'getPercentualRecebido'),
),
Aí no meu controller, criei a função getPercentualRecebido assim:
protected function getPercentualRecebido($data,$row) {
<< ... contas ... >>
return = CHtml::tag("div", array("class"=>"progress"),
CHtml::tag("div", array("class"=>"bar", "style"=>"width: ".$percentual."%;"), "", true), true);
}
Custei, mas consegui !!!
Valeu !
gustgon
(Gustgon)
5
Newerton,
Você é o cara !!!
Funcionou perfeito também !!
Valeu novamente!