Creates a multiselect based on http://www.quasipartikel.at/multiselect/
Yii 1.1 or more (Tested on 1.1.7)
Place emultiselect folder in /protected/widget/ Add to form views as needed:
$this->widget( 'application.widget.emultiselect.EMultiSelect', array('sortable'=>false/true, 'searchable'=>false/true) );
Add the class multiselect and multiselect to dropdowns that you want to be multiselected.
Eg:
echo $form->dropDownList( $model, 'trainings', $trainings, array('multiple'=>'multiple', 'key'=>'trainings', 'class'=>'multiselect') );
Total 8 comments
Here is my proposal - tried it and it works well.
Add below attributes
then in registerScripts() $params should be declared like below instead of empty array.
and need to remove
Now you can set any attirbute like below:
If doing it in your CSS file, you may need to add !important eg .multiselect { width: 460px !important; height: 200px !important; }
Alternatively, you can edit the CSS file in the assets folder of the widget (/protected/widget/emultiselect/assets).
In any case, make sure you clear your project assests folder (/assets/) so that the cache gets reset and it reloads the widget assets and your theme assets.
@wiseloren
Thanks. I've tried that but I can't get it to work.
I also tried to set the width option in the javascript file but to no effect.
Is the width hardcoded?
You can override the style in your style sheet. /* multiselect styles */ .multiselect { width: 460px; height: 200px; }
Is it possible to set the width option?
Don't work with CForm. Should extend CInputWidget.
Even worked with my advanced Relation widgets, no problem.
As mentioned in the comments here also, I placed this in my Extension folders, so I had to change my paths as well. I used the shortcut "ext.emultiselect.assets".
Nice extension but with a few bugs..
When add to form..
Change to..
EmultiSelect.php - Line #60
Change to...
or
Leave a comment
Please login to leave your comment.