forked from Mirrors/apostrophe
151 lines
5.1 KiB
HTML
151 lines
5.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<title>Custom buttons - Handsontable</title>
|
|
|
|
<!--
|
|
Loading Handsontable (full distribution that includes all dependencies)
|
|
-->
|
|
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.full.css">
|
|
<script data-jsfiddle="common" src="../dist/handsontable.full.js"></script>
|
|
|
|
<script data-jsfiddle="common" src="../plugins/removeRow/handsontable.removeRow.js"></script>
|
|
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="../plugins/removeRow/handsontable.removeRow.css">
|
|
|
|
<!--
|
|
Loading demo dependencies. They are used here only to enhance the examples on this page
|
|
-->
|
|
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css?20140331">
|
|
<script src="js/samples.js"></script>
|
|
<script src="js/highlight/highlight.pack.js"></script>
|
|
<link rel="stylesheet" media="screen" href="js/highlight/styles/github.css">
|
|
<link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css">
|
|
|
|
<!--
|
|
Facebook open graph. Don't copy this to your project :)
|
|
-->
|
|
<meta property="og:title" content="Custom buttons">
|
|
<meta property="og:description"
|
|
content="The alter method can be used if you want to insert or remove rows and columns using external buttons">
|
|
<meta property="og:url" content="http://handsontable.com/demo/buttons.html">
|
|
<meta property="og:image" content="http://handsontable.com/demo/image/og-image.png">
|
|
<meta property="og:image:type" content="image/png">
|
|
<meta property="og:image:width" content="409">
|
|
<meta property="og:image:height" content="164">
|
|
<link rel="canonical" href="http://handsontable.com/demo/buttons.html">
|
|
|
|
<!--
|
|
Google Analytics for GitHub Page. Don't copy this to your project :)
|
|
-->
|
|
<script src="js/ga.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
<div class="wrapper">
|
|
<div class="wrapper-row">
|
|
<div id="global-menu-clone">
|
|
<h1><a href="../index.html">Handsontable</a></h1>
|
|
|
|
</div>
|
|
|
|
<div id="container">
|
|
<div class="columnLayout">
|
|
|
|
<div class="rowLayout">
|
|
<div class="descLayout">
|
|
<div class="pad" data-jsfiddle="example1">
|
|
<h2>Custom buttons</h2>
|
|
|
|
<p>The <b>alter</b> method can be used if you want to insert or remove rows and columns using external
|
|
buttons.
|
|
The below example uses the a custom made
|
|
<b>handsontable.removeRow.js</b> plugin for that matter. Move your mouse over a row to see it.</p>
|
|
|
|
<p>You can programically select a cell using the <b>selectCell</b> method. The below button implements it.</p>
|
|
|
|
<p>
|
|
<button id="selectFirst">Select first cell</button>
|
|
<label><input type="checkbox" id="rowHeaders" checked="checked" autocomplete="off"> Show row headers</label>
|
|
<label><input type="checkbox" id="colHeaders" checked="checked" autocomplete="off"> Show col headers</label>
|
|
</p>
|
|
|
|
<div id="example1" style="width: 400px; height: 300px; overflow: hidden;"></div>
|
|
|
|
<p>
|
|
<button name="dump" data-dump="#example1" data-instance="hot" title="Prints current data source to Firebug/Chrome Dev Tools">
|
|
Dump data to console
|
|
</button>
|
|
</p>
|
|
|
|
<style>
|
|
|
|
</style>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="codeLayout">
|
|
<div class="pad">
|
|
<div class="jsFiddle">
|
|
<button class="jsFiddleLink" data-runfiddle="example1">Edit in jsFiddle</button>
|
|
</div>
|
|
<script data-jsfiddle="example1">
|
|
var data = [
|
|
['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
|
|
['2008', 10, 11, 12, 13],
|
|
['2009', 20, 11, 14, 13],
|
|
['2010', 30, 15, 12, 13]
|
|
],
|
|
container = document.getElementById('example1'),
|
|
selectFirst = document.getElementById('selectFirst'),
|
|
rowHeaders = document.getElementById('rowHeaders'),
|
|
colHeaders = document.getElementById('colHeaders'),
|
|
hot;
|
|
|
|
hot = new Handsontable(container, {
|
|
startRows: 15,
|
|
startCols: 16,
|
|
rowHeaders: true,
|
|
colHeaders: true,
|
|
minSpareCols: 1,
|
|
minSpareRows: 1,
|
|
contextMenu: false,
|
|
outsideClickDeselects: false,
|
|
removeRowPlugin: true
|
|
});
|
|
hot.loadData(data);
|
|
|
|
Handsontable.Dom.addEvent(selectFirst, 'click', function () {
|
|
hot.selectCell(0,0);
|
|
});
|
|
Handsontable.Dom.addEvent(rowHeaders, 'click', function () {
|
|
hot.updateSettings({
|
|
rowHeaders: this.checked
|
|
});
|
|
});
|
|
Handsontable.Dom.addEvent(colHeaders, 'click', function () {
|
|
hot.updateSettings({
|
|
colHeaders: this.checked
|
|
});
|
|
});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer-text">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outside-links-wrapper"></div>
|
|
|
|
</body>
|
|
</html>
|