I have a JSON that looks something like this (still to be finished, can be adapted throughout the project, can use fake data):
```
var rows = [
{'date': ('2016-01-01'), 'account': 'Revenues', 'code': 3000000, 'value': 4700.0, 'level': 1},
{'date': ('2016-01-01'), 'account': 'Revenues', 'code': 3010000, 'value': 4700.0, 'level': 2},
{'date': ('2016-01-01'), 'account': 'Revenues', 'code': 3010000, 'value': 4700.0, 'level': 3},
{'date': ('2016-01-01'), 'account': 'Revenues', 'code': 3010100, 'value': 4700.0, 'level': 4},
{'date': ('2016-01-01'), 'account': 'Benefits', 'code': 3010102, 'value': 300.0, 'level': 4},
{'date': ('2016-01-01'), 'account': 'Expenses', 'code': 3010102, 'value': 0, 'level': 1},
{'date': ('2016-01-01'), 'account': 'Expenses', 'code': 3010102, 'value': 0, 'level': 2},
{'date': ('2016-01-01'), 'account': 'Expenses', 'code': 3010102, 'value': 0, 'level': 3},
{'date': ('2016-01-01'), 'account': 'Rent', 'code': 4020101, 'value': -2150.0, 'level': 4},
{'date': ('2016-01-01'), 'account': 'Car', 'code': 4020108, 'value': -400.0, 'level':4},
{'date': ('2016-01-01'), 'account': 'Food1', 'code': 4020201, 'value': -1191.58, 'level': 4},
{'date': ('2016-01-01'), 'account': 'Food2', 'code': 4020202, 'value': -264.88, 'level': 4},
```
I need to make a HTML table using JavaScript.
This table has the following features:
1. Collapsible: when I click Level 1, it collapses all of it's direct children (and the children of the children as well). The for Level 2 and Level 3.
2. Columns: the first two columns are fixed (account and code), the value is given for a specific month, and the columns are the monthly data.
3. Style: Level 1 rows are bold and have a different style from level 2, 3 and 4, for example.
4. Fixed TOTAL column: the last column is the sum of all previous columns values, and it is fixed.
5. Loading Time: it has to be fast.
6. Totals Rows: Revenus minus Costs will equal (GROSS PROFIT) which is a calculated row. GROOS PROFIT minus EXPENSES will equal EBIT. I can even make the calculation on the backend, but the table must consider this.
I probably could restructure the JSON on the backend if needed, so we can discuss which data structure would be best to work with.
Even though I would prefer vanilla JavaScript, there's nothing too bad about jQuery.
Thanks.