我想允許用戶通過點擊一個按鈕(比如紅色,綠色和藍色按鈕)來給選定的單元格着色。Handsontable着色單元格使用按鈕
要獲得所選單元格,我發現這個代碼:
$('div#example1').handsontable(options);
//get the instance using jQuery wrapper
var ht = $('#example1').handsontable('getInstance');
//Return index of the currently selected cells as an array [startRow, startCol, endRow, endCol]
var sel = ht.getSelected();
//'alert' the index of the starting row of the selection
alert(sel[0]);
但點擊一個按鈕,當我不能運行這段代碼,因爲選擇之後點擊和功能開始運行之前「消失」。
我嘗試以下this instruction但我需要解決此問題。
嘿謝謝你的想法。在嘗試之前,我需要找到一種方法將選擇的顏色保存到數據庫中,並在稍後進行正確提取和渲染。一旦我有解決方案,我會在這裏發佈。 –