Yii Framework Forum: Emultiselect In Cform - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Emultiselect In Cform EMultiSelect CForm

#1 User is offline   Johnny Gan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 206
  • Joined: 30-May 13

Posted 30 August 2013 - 04:24 PM

I try to share my code in
http://www.yiiframew...on-emultiselect

But it does not allow me to add my screen shots. So open a new topic.



Emultiselect is very nice extension. I used this in my wizard form. Although it took me a few hours to insert it into CForm.

Attached File  emultiselect.png (21.67K)
Number of downloads: 12

Share what I did, in case some people want to do same thing.

After you installed emultiselect into your /protected/widget/, you can not use this widget in the CForm as one element directly, But after you look into the EMultiSelect.php, you will find this widget is added jquery code to handle dropdown list. then what you need to do is added the code after $form in the view.
echo CHtml::tag('div',array('class'=>'form'),$form);
$this->widget(
		'application.widget.emultiselect.EMultiSelect',
		array(
			'sortable'=>true, 
			'searchable'=>true,
			'dividerLocation'=>0.5, //this is divide the column half-half. You need add this into EMultiSelect.php so it can handle that.
		)
);

Then in your wizard step model add drop down list into getForm() function.
$return=new CForm(array(
	'showErrorSummary'=>true,
	'elements'=>array(
		'<p>Search tools from available tool list, then click "+" to add into selected list.
		</p>',
		'tool_list'=>array(
			'type'=>'dropdownlist',
			'items'=>$avaliableToolList,//CHtml::listData(Costcenter::model()->findAll(), 'costcenter_id', 'costcenterFullName'),
			'label'=>'Available transfer tool list' ,
			'attributes'=>array(							
				'multiple'=>'multiple',
				'key'=>'trainings',
				'class'=>'multiselect',
			),
		),				
...

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users