YiiBooster icon indicating copy to clipboard operation
YiiBooster copied to clipboard

Add HTML code to Select2 tags

Open lmsmartins opened this issue 10 years ago • 0 comments

Hi,

Is there any way to add html to the tags array in select2? Something like 'type' => 'raw'? I would like to add a picture, name and email for each select item. Here's my code:

    echo $form->select2Group(
        $model,
        'contacts',
        array(
            'wrapperHtmlOptions' => array(
                'class' => 'col-sm-5',
                'type' => 'raw',
            ),
            'widgetOptions' => array(
                'asDropDownList' => false,
                'options' => array(
                    'tags' => $model->loadContacts(),
                    'placeholder' => 'Write email contacts',
                    'tokenSeparators' => array(',', ' '),
                ),
            ),
        )
    );

Thank you.

lmsmartins avatar Aug 17 '14 03:08 lmsmartins