[Vuejs]-Vuetify simple table. Convert nested object propertied to <td> columns

0👍

In the absence of any other suggestions, I have create a method to remap the data into a single array:

methods: {
     remapPricelists(style,colours,sizes){
          /* This should find a single match */
          let group = this.groups.filter(g=>{
               return g.style ==  style 
                 && g.colours == colours
                 && g.sizes == sizes
          });
          let pl =[];
          group[0].pricelists.map(plst =>{
               pl = pl.concat(plst.pricelists);
          });
          return pl;
      }
}

DISCLAIMER: I have edited the above code from my live data which has a slightly different format (more outer groups and differently named fields) so E&OE. In production, I will likely abstract the group fetch to a separate method as I am going to need it in lots of places and will likely strip the outer array to just leave the group object so that I can access the inner data without having to specify the group array-index.

Leave a comment