forked from Dogfalo/materialize
-
-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
Milestone
Description
Autocomplete is restricted to the raw value of an input, which makes it difficult to parse id's and other information to the backend. There are many inelegant solutions out there, but materialize should support this natively.
For better understanding, autocomplete should work like a select, where you can pass a database reference (over the value="" attribute) and a human readable data (between the tag).
Expected Behavior
Autocomplete should be able to pass multidata. Arrays, Objects, JSONs, etc.
$('input.autocomplete').autocomplete2({
data: [
{id:1,text:'Apple',img:'http://placehold.it/250x250'},
{id:2,text:'Microsoft',img:'http://placehold.it/250x250'},
{id:3,text:'Google',img:'http://placehold.it/250x250'},
]
});
Current Behavior
Autocomplete can only pass the raw value of an input and set a icon on the right side.
$(document).ready(function(){
$('input.autocomplete').autocomplete({
data: {
"Apple": null,
"Microsoft": null,
"Google": 'https://placehold.it/250x250'
},
});
});
Possible Solution
A complete solution is done and provided by phoebebright here:
https://gist.github.com/phoebebright/b309b990af3a29be9c30793eab91b79d
wuda-io and manuthecoder