javve / list.js

The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML.
https://listjs.com
MIT License
11.2k stars 896 forks source link

list nested objects but not need a nested list #772

Open mauromago opened 7 months ago

mauromago commented 7 months ago

Hi

I need to make a list from a geojson data I use in open layer. Data can't be changed. I tried in many way to do it using list.js, that looks me be perfect for my need. However I can not be able to do it.

My data is something like that:

var json_2 = [ {"properties": { "zona": "Italia", "nome": "A"} }, {"properties": { "zona": "Italia", "nome": "I" } } ]

I should like to have a list with:

Italia - A Italia - I

Is it possible in some way without parse the data?

valerio-bozzolan commented 6 months ago

Thanks for this issue. I'm not the library maintainer but I don't think that the library will ever support a native format for custom JavaScript objects like zona: <something> or nome: <something> really.

Adapting data is not generally bad, expecially in these situations. I mean: you can keep the original data exactly as-is, while it's possible to just adapt the data on-the-fly into a new desired data structure, and put that as input of the library.