Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My text document Date: 20-06-2019 Created by: OJN
- Content Nice Document Very!
- Content Indeed!
- Even more!
- {
- "1":[
- {
- "row":"My text document"
- },
- {
- "row":"Content"
- },
- {
- "row":"Content"
- }
- ],
- "2":[
- {
- "row":"Date: 20-06-2019"
- },
- {
- "row":"Nice Document"
- },
- {
- "row": "Indeed!"
- },
- {
- "row": "Even more!"
- }
- ],
- "3":[
- {
- "row":"Created by: OJN"
- },
- {
- "row":"Very!"
- }
- ]
- }
- 0: Array(3)
- 1: Array(4)
- 2: Array(2)
- <table border="1">
- <tbody>
- <tr v-for="(row, index) in dataTable" :key="index">
- <td v-for="(cell, index) in row" :key="index">
- <span v-if="cell">{{cell["row"]}}</span>
- </td>
- </tr>
- </tbody>
- </table>
- // Transform object in array of its values
- let data = Object.values(content);
- let colsLength = data.map(r => r.length);
- let maxNumCols = Math.max.apply(Math, colsLength);
- let recordArraySchema = Array.apply(null, Array(maxNumCols)).map((r, i) => i);
- this.dataTable = recordArraySchema.map((col, i) => data.map(row => row[i]));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement