janl / mustache.js

Minimal templating with {{mustaches}} in JavaScript

Home Page:https://mustache.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to render json data like pivot table

AshishTondare175 opened this issue · comments

Hi @janl

How to render Json data in html format like pivot table.

Note : Data is dynamic.

data:[{
admissiondate:'2021-06-15'
name: 'Ashish'
age : '27'
department:'IT'
},
{
admissiondate:'2021-06-15'
name: 'Ravi'
age : '28'
department:'IT'
},
{
admissiondate:'2021-06-16'
name: 'Tejas'
age : '25'
department :'CSE'
},
{
admissiondate:'1992-06-16'
name: 'Akshay'
age : '29'
department :'MECH'
}

I want output like that

                                                              2021-06-15                2021-06-16
     Department              Name                                                             
                                       25     26     27     28    29    25     26     27     28    29
           IT           Ashish          0      0     0    1      0    0      0     0    0     0
                            Ravi             0      0    0     1      0    0      0     0    0      0
          CSE          Tejas          0    0     0     0     0   1   0     0    0      0
          MECH        Akshay        0     0    0    0   0  0      0     0    0     1

this question is out of scope for the mustache.js library