davidstutz / bootstrap-multiselect

JQuery multiselect plugin based on Twitter Bootstrap.
https://davidstutz.github.io/bootstrap-multiselect/
Other
3.68k stars 1.98k forks source link

dataprovider results in "undefined" entries in dropdown #349

Closed pascoea closed 10 years ago

pascoea commented 10 years ago
var data=[
{label:"1", value:"1 val"},
{label:"2", value:"2 val"}
];
$('.multiSelectDropdown').multiselect('dataprovider', data);

returns a drop down with two entries with value and data of 'undefined'

gbouthenot commented 10 years ago

This is a regression is v0.9.5. Fixed in v0.9.6. What version are you using ?

pascoea commented 10 years ago

Yep, looks good. you have the same work-around I came up with.

Thank you!

laynebay commented 10 years ago

This is a great tool - Thanks! So I have a similar issue - I'm tried every which way to populate this list (object?) dynamically, but either get all 4 values as undefined or a single value correctly. I've returned valid JSON, a string that matched exactly the syntax, etc. but cannot seem to dial in the correct combo.

When I paste in to the js file what I'm returning, it's correct, but I can't make a diff with rebuild, etc.

What would I need to return (and how) via Ajax form a PHP? Thanks.