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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -