Jui Autocomplete Data Format


$products = ArrayHelper::map(Products::find()->all(), ‘id’, ‘name’);

I have taken my products list as array using the above code which outputs



[1] => shirt

[2] => pant

[3] => t-shirt

[4] => sample


and in my view i have passed the array to Jui Autocomplete widget as

<?= AutoComplete::widget([

'model' =&gt; &#036;products,

'attribute' =&gt; 'products',

'clientOptions' =&gt; [

    'source' =&gt; &#036;products,


]); ?>

which it results in jquery as


but my autocomplete doesn’t populates the result.

What I’m lacking in please advise. Thanks in advance.