javascript - Display nested objects using w3-repeat of w3.js library -
i'm trying display array of objects nested array of objects using tag w3-repeat
of library w3.js. know it's not main used library, i'm new stuff , liked w3.css style css styling (simple , easy-to-learn) , i'm trying w3.js javascript side. i'm trying make table starting object this:
var myobject = { "deliveries" : [ { "state" : "inside", "arrive" : "15/09/17 - 15:00", "courier" : "courier 1", "cli-cust" : [ { "type" : "client", "name" : "cli. name", "goods" : [ {"material" : "pasta", "qt" : "200"}, {"material" : "bread", "qt" : "300"}, {"material" : "oil", "qt" : "1000"} ] }, { "type" : "customer", "name" : "name of customer", "goods" : [ {"material" : "water", "qt" : "100"}, {"material" : "wine", "qt" : "3000"}, {"material" : "prosecco", "qt" : "2000"} ] } ] }, { "state" : "outside", "arrive" : "15/09/17 - 16:00", "courier" : "courier 2", "cli-cust" : [ { "type" : "client", "name" : "name of client 2", "goods" : [ {"material" : "notebook", "qt" : "10"}, {"material" : "keyboard", "qt" : "30"} ] } ] } ] }
basically result should table this: now, tryed tag
w3-repeat
seems work first level of array objects (state, arrive, courier), not others:
works fine:
<tr w3-repeat="deliveries"> <td>{{state}}</td> <td>{{arrive}}</td> <td>{{courier}}</td>
but second level object have tryed use like
<ul w3-repeat="cli-cust"> <li>{{type}}</li> <li>{{name}}</li> </ul>
and third level similar
<ul w3-repeat="goods"> <li>{{material}}</li> <li>{{qt}}</li> </ul>
but not work: gives {{type}}
, {{name}}
, {{material}}
, {{qt}}
text in output, seems can't use nested objects loop array. obtain same result using w3-repeat="deliveries.cli-cust"
, w3-repeat="deliveries.goods"
instead of w3-repeat="cli-cust"
, w3-repeat="goods"
.
am missing or library can't support feature?
thanks
ettore
Comments
Post a Comment