forked from Mirrors/apostrophe
135 lines
4.5 KiB
HTML
135 lines
4.5 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<title>Align cell - 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>
|
|
|
|
<!--
|
|
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">
|
|
<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="Align cells">
|
|
<meta property="og:description"
|
|
content="This example shows the usage of the align cell's content feature.">
|
|
<meta property="og:url" content="http://handsontable.com/demo/align_cell.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/align_cell.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>Horizontal & vertical alignment</h2>
|
|
|
|
<p>To initialize Handsontable with predefined horizontal and vertical alignment, provide className cells
|
|
details
|
|
in form of a grid, <code>columns</code> or <code>cell</code> setting (see code sample below).
|
|
</p>
|
|
|
|
<p>Available classNames:</p>
|
|
|
|
<ul>
|
|
<li>horizontal: <code>htLeft</code>, <code>htCenter</code>, <code>htRight</code>, <code>htJustify</code>,
|
|
</li>
|
|
<li>vertical: <code>htTop</code>, <code>htMiddle</code>, <code>htBottom</code>.</li>
|
|
</ul>
|
|
|
|
<p>Alignment changes can be tracked using <code>afterSetCellMeta</code> hook callback.</p>
|
|
|
|
<div style="overflow: hidden; height: 200px; width: 400px">
|
|
<div id="example1"></div>
|
|
</div>
|
|
|
|
<p>
|
|
<button name="dump" data-dump="#example1" data-instance="hot1"
|
|
title="Prints current data source to Firebug/Chrome Dev Tools">
|
|
Dump data to console
|
|
</button>
|
|
</p>
|
|
</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 container = document.getElementById('example1'),
|
|
hot1;
|
|
|
|
hot1 = new Handsontable(container, {
|
|
data: Handsontable.helper.createSpreadsheetData(1000, 16),
|
|
colWidths: [55, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47], // can also be a number or a function
|
|
rowHeaders: true,
|
|
colHeaders: true,
|
|
contextMenu: true,
|
|
mergeCells: [
|
|
{row: 1, col: 1, rowspan: 3, colspan: 3},
|
|
{row: 3, col: 4, rowspan: 2, colspan: 2}
|
|
],
|
|
className: "htCenter",
|
|
cell: [
|
|
{row: 0, col: 0, className: "htRight"},
|
|
{row: 1, col: 1, className: "htLeft htMiddle"},
|
|
{row: 3, col: 4, className: "htLeft htBottom"}
|
|
],
|
|
afterSetCellMeta: function (row, col, key, val) {
|
|
console.log("cell meta changed", row, col, key, val);
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer-text">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outside-links-wrapper"></div>
|
|
|
|
</body>
|
|
</html>
|