UNPKG

@quantlab/handsontable

Version:

Spreadsheet-like data grid editor that provides copy/paste functionality compatible with Excel/Google Docs

147 lines (123 loc) 5.48 kB
<!doctype html> <html> <head> <meta charset='utf-8'> <title>jQuery - Handsontable</title> <!-- Loading Handsontable (full distribution that includes all dependencies apart from jQuery) --> <script data-jsfiddle="common" src="js/jquery.min.js"></script> <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.css"> <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/pikaday/pikaday.css"> <script data-jsfiddle="common" src="../dist/pikaday/pikaday.js"></script> <script data-jsfiddle="common" src="../dist/moment/moment.js"></script> <script data-jsfiddle="common" src="../dist/numbro/numbro.js"></script> <script data-jsfiddle="common" src="../dist/numbro/languages.js"></script> <script data-jsfiddle="common" src="../dist/handsontable.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?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="Integrate with Backbone.js"> <meta property="og:description" content="Bind your Backbone collections to Handsontable"> <meta property="og:url" content="http://handsontable.com/demo/backbone.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/backbone.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="hot"> <h2>jQuery</h2> <p> jQuery is a library, which makes DOM manipulations and event handling easier. <br><br> Handsontable is fully compatible with jQuery - the small example below shows that the integration between the two is quick and intuitive. </p> <p> In order to use Handsontable as a jQuery plugin, you need to do some preparation: <ul> <li>Include jQuery to your page, before including Handsontable<br> <pre><code style="white-space: pre-line;"> &lt;script src="handsontable/lib/jquery.min.js"&gt;&lt;/script&gt;<br> &lt;script src="handsontable/dist/handsontable.full.js"&gt;&lt;/script&gt;<br> &lt;link rel="stylesheet" media="screen" href="handsontable/dist/handsontable.full.css"&gt;<br> </code></pre> </li> <li> Run <code>handsontable()</code> plugin constructor on an empty div as in the below code example: </li> </ul> </p> <div id="hot"></div> </div> </div> <div class="codeLayout"> <div class="pad"> <div class="jsFiddle"> <button class="jsFiddleLink" data-runfiddle="hot">Edit in jsFiddle</button> </div> <script data-jsfiddle="common"> function getData() { return [ ['', 'Kia', 'Nissan', 'Toyota', 'Honda'], ['2008', 10, 11, 12, 13], ['2009', 20, 11, 14, 13], ['2010', 30, 15, 12, 13] ]; } </script> <script data-jsfiddle="hot"> // Instead of creating a new Handsontable instance with the container element passed as an argument, // you can simply call .handsontable method on a jQuery DOM object. var $container = $("#hot"); $container.handsontable({ data: getData(), startRows: 5, startCols: 5, minRows: 5, minCols: 5, maxRows: 10, maxCols: 10, rowHeaders: true, colHeaders: true, minSpareRows: 1, contextMenu: true }); // This way, you can access Handsontable api methods by passing their names as an argument, e.g.: var hotInstance = $("#hot").handsontable('getInstance'); </script> </div> </div> </div> <div class="footer-text"> </div> </div> </div> </div> </div> <div id="outside-links-wrapper"></div> </body> </html>