[Resolvido] Inserir Um Widget Em Uma Coluna De Um Gridview

Pessoal, bom dia.

É o seguinte, quero colocar uma barra de progresso em uma coluna do GridView. Isso é possível ?

  • Widget = Progress Bar

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 !

uma forma seria inserir o html direto:

http://twitter.github.com/bootstrap/components.html#progress

Gustavo,

Tenta usar:


'value'=>'$this->grid->controller->widget("bootstrap.widgets.TbProgress", array("type"=>"success", "percent"=>60), true)',

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 !

Newerton,

Você é o cara !!!

Funcionou perfeito também !!

Valeu novamente!