Yiiwheels -> Wheditablecolumn, Select2 Allow Empty Value In Dropdownlist

Hi folks,

I am pretty sure this will be simple and probably staring me in the face but I just haven’t been able to work it out.

I have a column in a table that is a FK to another table but also allows NULL. I want to create a dropdownlist that will allow me to select the FK but also allow me to set it back to NULL if need be.

Currently, I have this…




array(

    'class' => 'yiiwheels.widgets.editable.WhEditableColumn',

    'name'  => 'tournament_fk',

    'editable' => array(

        'type' => 'select2',

        'url' => $this->createUrl('TournamentFeeds/update'),

        'source' => Tournament::fkArray(),

    )

),



Can anyone give me advice on how I could modify this to allow to enter NULL? Tournament::fkArray() simply uses CHtml::listData to return a valid list.

Thanks in advance,

U4EA

U said that Tournament::fkArray() is just using Chtml::listData() to get valid list of FK from some table. Why don’t U just add one more option with an empty value? Something like :

$source = Chtml::listDat(…);

array_unshift($source, [’’=>‘NULL value’]);