kartik-v / yii2-widget-depdrop

Widget that enables setting up dependent dropdowns with nested dependencies (sub repo split from yii2-widgets).
Other
81 stars 39 forks source link

cannot use 'in' operator to search for 'length' in #75

Closed thiagomoraesp closed 5 years ago

thiagomoraesp commented 5 years ago

Im having a problem passing the json callback to the dep drop, i double checked and the json output is working well.

The error is:

"cannot use 'in' operator to search for 'length' in"

I already have the last version.

thiagomoraesp commented 5 years ago

Oh, i got it, the json return differs from the first element(where the array key is the id and the content is the description), is not this a usability issue?

thiagomoraesp commented 5 years ago

For those experiencing the same question(or for me in the future ;) ), the expected json output is:

{"output":[ {"id":10,"name":"item1"}, {"id":11,"name":"item2"}, ]{"id":12,"name":"item3"}], "selected":10}

kartik-v commented 5 years ago

Yes this is been stated in the docs. Suggest to read documentation on expected format for dependent dropdown ajax response.