javascript - Merging the cell using button in handsontable -
in handsontable, can merge cell pressing ctrl + m. want merge cell in handsontable using button. not in coding, suggestion or appreciated.
<script> document.addeventlistener("domcontentloaded", function() { var container = document.getelementbyid('maintable'), hot; hot = new handsontable(container, { data: handsontable.helper.createspreadsheetdata(50, 26), minrows: 5, mincols: 6, rowheaders: true, colheaders: true, mergecells: true, currentrowclassname: 'current row', currentcolclassname: 'current col' }); hot.selectcell(2,2); function binddumpbutton() { if (typeof handsontable === "undefined") { return; } handsontable.dom.addevent(document.body, 'click', function (e) { var element = e.target || e.srcelement; if (element.nodename == "button" && element.name == 'dump') { var name = element.getattribute('data-dump'); var instance = element.getattribute('data-instance'); var hot = window[instance]; console.log('data of ' + name, hot.getdata()); } }); } binddumpbutton(); });
Comments
Post a Comment