jquery-flexdatalist icon indicating copy to clipboard operation
jquery-flexdatalist copied to clipboard

Working with nested data

Open Abrahamlet opened this issue 6 years ago • 2 comments

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?

Abrahamlet avatar Jan 13 '19 11:01 Abrahamlet

Hey @Abrahamlet I found myself in a similar situation, here is my Pull Request: https://github.com/sergiodlopes/jquery-flexdatalist/pull/195

sylvainblot avatar Feb 16 '19 11:02 sylvainblot

@sylvainblot Awesome! Thank you for this.

Abrahamlet avatar Feb 16 '19 17:02 Abrahamlet