1
のJSON表現を取得します:JSBin:次のスクリプトは、3x2の編集可能なテーブルを作ることができますhandsontable
<!DOCTYPE html>
<html>
<head>
<script src="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.min.css">
</head>
<body>
<div id="example1" class="hot handsontable htRowHeaders htColumnHeaders"></div>
<br><br>
<div class="json-result">to print a JSON representation</div>
</body>
</html>
はJavaScript:
document.addEventListener("DOMContentLoaded", function() {
function getData() {
return [
['A1', 'B1'],
['A2', 'B2'],
['A3', 'B3']];
}
var
example1 = document.getElementById('example1'),
settings1,
hot1;
settings1 = {
data: getData(),
rowHeaders: false,
colHeaders: false,
contextMenu: false
};
hot1 = new Handsontable(example1, settings1);
});
手動でテーブルにいくつかの値を変更した後、私は希望テーブルのセルの値を表すJSON値を返し、div
json-result
に出力します。誰も私がそうするために使用できるAPIを知っていますか?
結果のJSONはどのように見えますか? –