jquery-flexdatalist
jquery-flexdatalist copied to clipboard
Working with nested data
I've been playing with flexdatalist for a few days now and like it a lot. But I'm having difficulty getting the results from nested json objects to show in the control. Here's my code:
$("#address").flexdatalist({
keywordParamName: "q",
searchDelay: 300,
searchIn: ["city", "hamlet", "town", "village"],
textProperty: '{city}, {state}, {country}',
valueProperty: 'city',
visibleProperties: ["city", "state", "country"],
url: 'http://nominatim.openstreetmap.org/search?format=jsonv2&addressdetails=1&dedupe=1'
}).on("after:flexdatalist.data", function(event, data){
console.log(data); // this is just to see if any data is actually being returned
});
The data I'm trying to retrieve is under a property named "address". I've tried prepending the values given for the searchIn, textProperty, valueProperty, and visibleProperties options above with "address" (e.g. "address.city") but to no avail.
Can anyone help me with this?
Hey @Abrahamlet I found myself in a similar situation, here is my Pull Request: https://github.com/sergiodlopes/jquery-flexdatalist/pull/195
@sylvainblot Awesome! Thank you for this.