基本的に、ここでは 2 つのことが必要です。
1: handsontables で、uniformJS 様式化されたチェックボックスが機能しません。2: 対応する列のチェックボックスを「すべてチェック」するには、Handsontable ヘッダーにチェックボックスが必要です。
jQuery .append() を介してテーブルにチェックボックスを追加できると思いますが、Handsontables を操作するためのより正しい方法はありますか? 前もって感謝します。
jQuery
$('input').uniform();
$(document).ready(function () {
function getCarData() {
return [
{car: "Mercedes A 160", year: 2006, available: true, comesInBlack: 'yes'},
{car: "Citroen C4 Coupe", year: 2008, available: false, comesInBlack: 'yes'},
{car: "Audi A4 Avant", year: 2011, available: true, comesInBlack: 'no'},
{car: "Opel Astra", year: 2004, available: false, comesInBlack: 'yes'},
{car: "BMW 320i Coupe", year: 2011, available: false, comesInBlack: 'no'}
];
}
$("#example1").handsontable({
data: getCarData(),
startRows: 7,
startCols: 4,
colHeaders: ["Car", "Year", ""],
colWidths: [120, 50, 60],
columnSorting: true,
columns: [
{
data: "car"
//1nd column is simple text, no special options here
},
{
data: "year",
type: 'numeric'
},
{
data: "available",
type: "checkbox"
}
]
});
});
HTML
<input type="checkbox" checked /> Checkbox
<div id="example1" class="handsontable"></div>