jsp - Remove last three columns of Handsontable -
i have simple handsontable displays data mysql table. unfortunately i'm retrieving data , need remove or hide added columns. i've searched on internet , seem possible, every example have found doesn't seem work.
results.jsp
<script> var data = ${jsonproducts}; var ht = new handsontable(datatable, { data: data, startrows: data.length, readonly: true, maxcols: 7, colheaders: true, colheaders: ["id", "problem", "solution", "deadline", "type", "status", "developer"], }); </script> i tried maxcols: 7 doesn't work.
this how i'm retrieving data (not that's it's relevant question)
@requestmapping(value = "/result", method = requestmethod.get) public string defaultview(model model) { iterable<request> request = requestrepository.findall(); model.addattribute("requests", request); gson gson = new gson(); string json = gson.tojson(request); model.addattribute("jsonproducts", json); return "form/result"; } this table looks currently: current state of handsontable
i show first 7 columns , hide last 3.
any appreciated.
you need explicitly define columns want display in grid original array of arrays data source in such case. example:
<script> var data = ${jsonproducts}; var ht = new handsontable(datatable, { data: data, startrows: data.length, readonly: true, maxcols: 7, columns: [{ data: 0, type: 'text' }, { data: 1, type: 'text' }, { data: 2, type: 'text' }, { data: 3, type: 'text' }, { data: 4, type: 'text'}], colheaders: true, colheaders: ["id", "problem", "solution", "deadline", "type", "status", "developer"], }); </script>
Comments
Post a Comment