handsontable / hot-table

Handsontable - Best Data Grid Web Component with Spreadsheet Look and Feel.
http://handsontable.github.io/hot-table/
MIT License
130 stars 36 forks source link

Json not interpreted correctly #37

Closed harso121 closed 7 years ago

harso121 commented 7 years ago

My Json is: {"id":"africa","divisions":[{"name":"Algeria"},{"name":"Angola"},{"name":"Benin"},{"name":"Botswana"},{"name":"Burkina Faso"},{"name":"Burundi"},{"name":"Cameroon"},{"name":"Cape Verde"},{"name":"Central African Rep."},{"name":"Chad"},{"name":"Comoros"},{"name":"Congo"},{"name":"Côte d'Ivoire"},{"name":"Dem. Rep. Congo"},{"name":"Djibouti"},{"name":"Egypt"},{"name":"Eq. Guinea"},{"name":"Eritrea"},{"name":"Ethiopia"},{"name":"Gabon"},{"name":"Gambia"},{"name":"Ghana"},{"name":"Guinea"},{"name":"Guinea-Bissau"},{"name":"Kenya"},{"name":"Lesotho"},{"name":"Liberia"},{"name":"Libya"},{"name":"Madagascar"},{"name":"Malawi"},{"name":"Mali"},{"name":"Mauritania"},{"name":"Mauritius"},{"name":"Morocco"},{"name":"Mozambique"},{"name":"Namibia"},{"name":"Niger"},{"name":"Nigeria"},{"name":"Rwanda"},{"name":"S. Sudan"},{"name":"Sao Tome and Principe"},{"name":"Senegal"},{"name":"Seychelles"},{"name":"Sierra Leone"},{"name":"Somalia"},{"name":"South Africa"},{"name":"Sudan"},{"name":"Swaziland"},{"name":"Tanzania"},{"name":"Togo"},{"name":"Tunisia"},{"name":"Uganda"},{"name":"W. Sahara"},{"name":"Zambia"},{"name":"Zimbabwe"}]}

and my hot-table code: <hot-table datarows$="{{mapData}}" row-headers> <hot-column width="200" value$="divisions.name" header="Englischer Name"></hot-column> </hot-table>

But in order for it to display anything at all I'd have to change the value to "divisions.0.name", but that won't work for me as it will obviously only display the first item. How would I get it to display all of the items?

AMBudnik commented 7 years ago

Hi @harso121

Can you share a draft how your data should look like? Maybe the nested rows structure would work for you, here's an example: https://docs.handsontable.com/pro/1.8.1/demo-nested-rows.html

harso121 commented 7 years ago

I, unfortunately, don't have the PRO version, is there any way I can just convert it to a format that makes it work the normal way?

It should look like this: li

AMBudnik commented 7 years ago

I think that it's currently an only way http://jsfiddle.net/sa9vegfx/ Width nested objects we currently need to parse data to handle it.

harso121 commented 7 years ago

Hmm, I'll probably just reformat it using PHP to the needed format (like in the examples) and just parse that :) But thanks a lot!