diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-12-16 00:11:20 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-12-16 00:11:20 +0100 |
| commit | 3b10acc73247ec703ed47f0423e7d255a91f074e (patch) | |
| tree | fd1a86c51858a3a69d6181f60499dd7953b960a9 /client | |
| parent | f1461ec2727f26dacaf21a03d8698cf3f674c2cf (diff) | |
tabulator
Diffstat (limited to 'client')
| -rw-r--r-- | client/index.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/client/index.js b/client/index.js index bc57f548..2ee12c14 100644 --- a/client/index.js +++ b/client/index.js @@ -23,23 +23,24 @@ function appendTabulator(el, payload) { height: '311px', layout: 'fitColumns', placeholder: 'No Data Set', - columns: [ - // {title:'Name', field:'name', sorter:'string', width:200}, - // {title:'Progress', field:'progress', sorter:'number', formatter:'progress'}, - // {title:'Gender', field:'gender', sorter:"string"}, - // {title:"Rating", field:"rating", formatter:"star", align:"center", width:100}, - // {title:"Favourite Color", field:"col", sorter:"string", sortable:false}, - // {title:"Date Of Birth", field:"dob", sorter:"date", align:"center"}, - // {title:"Driver", field:"car", align:"center", formatter:"tickCross", sorter:"boolean"}, - ], + columns: payload.fields.split(', ').map(field => { + switch (field) { + default: + return { title: field, field: field.toLowerCase(), sorter: 'string' } + } + }), + // {title:'Name', field:'name', sorter:'string', width:200}, + // {title:'Progress', field:'progress', sorter:'number', formatter:'progress'}, + // {title:'Gender', field:'gender', sorter:"string"}, + // {title:"Rating", field:"rating", formatter:"star", align:"center", width:100}, + // {title:"Favourite Color", field:"col", sorter:"string", sortable:false}, + // {title:"Date Of Birth", field:"dob", sorter:"date", align:"center"}, + // {title:"Driver", field:"car", align:"center", formatter:"tickCross", sorter:"boolean"}, }) let path = payload.opt let columns = payload.fields.split(',').map(s => s.trim()) - console.log(columns) - if (path[0] !== '/') { - console.log(path) - } - // table.setData(path) + console.log(path, columns) + table.setData(path) } function appendApplets() { |
