I was just wondering the best way to query for autocomplete widget. I know how to use the select2 widget this is for the jui autocomplete and the data must be returned differently.
'source'=>array_keys(Companies::find()->where(['status' => Companies::STATUS_ACTIVE])->indexBy('name')->asArray()->all())
That works i just don’t know if there was a way to just return keys & values like
[
[0] =>'SomeValue',
[1]=>'someValue2'
]
Instead of returning all of the models info just return the name field with a key
I noticed that it will only work if the data is returned that way. If i assign another key value it won’t work it has to be in order ie 0 , 1, 2, 3 etc