Adding Tbselect2 To A Extendedgridview In Yiibooster

I have been bashing my head against this problem for a couple of days now.

I am trying to add a TBSelect2 widget to a existing TBExtendedGridView. ( I am using YiiBooster )




$this->widget('bootstrap.widgets.TbExtendedGridView',array(

		'id'=>'trximport-grid',

		'dataProvider'=>$dataProvider,

		'columns'=>array(

				array('name'=>'date_created', 'header'=>'Date Created'),

				array('name'=>'reference', 'header'=>'Reference'),

				array('name'=>'amount', 'header'=>'Amount'),

				array('name'=>'refActiveStatus_description', 'value'=>'$data->refActiveStatus->description', 'header'=>'Status' ),

				array('name'  => 'Account',

					  'type'  => 'raw',

					  'value' => '$this->grid->controller->widget("bootstrap.widgets.TbSelect2", array(

									    "model" =>$data,

									    "attribute" =>"ops_coop_sub_account_id",

									    "data"=>$data->accounts,

					                    "options" => array(

					                    ), 


 									),true);'),

				),

));




My problem is that it only renders the first row correctly (screenshot attached), from the next row it is just a standard dropdown that is rendered, which means I loose the search functionality to choose the correct item ( there can be a LOT of values populated )

The data is populated and loaded correctly.

It seems that the problem is somewhere else, where unfortunately my noob status shines thru. :rolleyes:

OK solved it. Seems like a bit of a hack, but it works.

I added




"htmlOptions"=>array("id"=>"col_".$data->id),



And now the jQuery identifies all the unique rows.




$this->widget('bootstrap.widgets.TbExtendedGridView',array(

		'id'=>'trximport-grid',

		'dataProvider'=>$dataProvider,

		'columns'=>array(

				array('name'=>'date_created', 'header'=>'Date Created'),

				array('name'=>'reference', 'header'=>'Reference'),

				array('name'=>'amount', 'header'=>'Amount'),

				array('name'=>'refActiveStatus_description', 'value'=>'$data->refActiveStatus->description', 'header'=>'Status' ),

				array('name'  => 'Account',

					  'type'  => 'raw',

					  'value' => '$this->grid->controller->widget("bootstrap.widgets.TbSelect2", array(

									    "model" =>$data,

									    "attribute" =>"ops_coop_sub_account_id",

										"htmlOptions"=>array("id"=>"col_".$data->id),

									    "data"=>$data->accounts,

					                    "options" => array(

					                    ), 

 									),true);'),

				),

));