jquery.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8'>
  5. <title>jQuery - Handsontable</title>
  6. <!--
  7. Loading Handsontable (full distribution that includes all dependencies apart from jQuery)
  8. -->
  9. <script data-jsfiddle="common" src="js/jquery.min.js"></script>
  10. <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.css">
  11. <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/pikaday/pikaday.css">
  12. <script data-jsfiddle="common" src="../dist/pikaday/pikaday.js"></script>
  13. <script data-jsfiddle="common" src="../dist/moment/moment.js"></script>
  14. <script data-jsfiddle="common" src="../dist/zeroclipboard/ZeroClipboard.js"></script>
  15. <script data-jsfiddle="common" src="../dist/numbro/numbro.js"></script>
  16. <script data-jsfiddle="common" src="../dist/numbro/languages.js"></script>
  17. <script data-jsfiddle="common" src="../dist/handsontable.js"></script>
  18. <!--
  19. Loading demo dependencies. They are used here only to enhance the examples on this page
  20. -->
  21. <link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css?20140331">
  22. <script src="js/samples.js"></script>
  23. <script src="js/highlight/highlight.pack.js"></script>
  24. <link rel="stylesheet" media="screen" href="js/highlight/styles/github.css">
  25. <link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css">
  26. <!--
  27. Facebook open graph. Don't copy this to your project :)
  28. -->
  29. <meta property="og:title" content="Integrate with Backbone.js">
  30. <meta property="og:description"
  31. content="Bind your Backbone collections to Handsontable">
  32. <meta property="og:url" content="http://handsontable.com/demo/backbone.html">
  33. <meta property="og:image" content="http://handsontable.com/demo/image/og-image.png">
  34. <meta property="og:image:type" content="image/png">
  35. <meta property="og:image:width" content="409">
  36. <meta property="og:image:height" content="164">
  37. <link rel="canonical" href="http://handsontable.com/demo/backbone.html">
  38. <!--
  39. Google Analytics for GitHub Page. Don't copy this to your project :)
  40. -->
  41. <script src="js/ga.js"></script>
  42. </head>
  43. <body>
  44. <div class="wrapper">
  45. <div class="wrapper-row">
  46. <div id="global-menu-clone">
  47. <h1><a href="../index.html">Handsontable</a></h1>
  48. </div>
  49. <div id="container">
  50. <div class="columnLayout">
  51. <div class="rowLayout">
  52. <div class="descLayout">
  53. <div class="pad" data-jsfiddle="hot">
  54. <h2>jQuery</h2>
  55. <p>
  56. jQuery is a library, which makes DOM manipulations and event handling easier. <br><br>
  57. Handsontable is fully compatible with jQuery - the small example below shows that the integration
  58. between the two is quick and intuitive.
  59. </p>
  60. <p>
  61. In order to use Handsontable as a jQuery plugin, you need to do some preparation:
  62. <ul>
  63. <li>Include jQuery to your page, before including Handsontable<br>
  64. <pre><code style="white-space: pre-line;">
  65. &lt;script src="handsontable/lib/jquery.min.js"&gt;&lt;/script&gt;<br>
  66. &lt;script src="handsontable/dist/handsontable.full.js"&gt;&lt;/script&gt;<br>
  67. &lt;link rel="stylesheet" media="screen" href="handsontable/dist/handsontable.full.css"&gt;<br>
  68. </code></pre>
  69. </li>
  70. <li>
  71. Run <code>handsontable()</code> plugin constructor on an empty div as in the below code example:
  72. </li>
  73. </ul>
  74. </p>
  75. <div id="hot"></div>
  76. </div>
  77. </div>
  78. <div class="codeLayout">
  79. <div class="pad">
  80. <div class="jsFiddle">
  81. <button class="jsFiddleLink" data-runfiddle="hot">Edit in jsFiddle</button>
  82. </div>
  83. <script data-jsfiddle="common">
  84. function getData() {
  85. return [
  86. ['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
  87. ['2008', 10, 11, 12, 13],
  88. ['2009', 20, 11, 14, 13],
  89. ['2010', 30, 15, 12, 13]
  90. ];
  91. }
  92. </script>
  93. <script data-jsfiddle="hot">
  94. // Instead of creating a new Handsontable instance with the container element passed as an argument,
  95. // you can simply call .handsontable method on a jQuery DOM object.
  96. var $container = $("#hot");
  97. $container.handsontable({
  98. data: getData(),
  99. startRows: 5,
  100. startCols: 5,
  101. minRows: 5,
  102. minCols: 5,
  103. maxRows: 10,
  104. maxCols: 10,
  105. rowHeaders: true,
  106. colHeaders: true,
  107. minSpareRows: 1,
  108. contextMenu: true
  109. });
  110. // This way, you can access Handsontable api methods by passing their names as an argument, e.g.:
  111. var hotInstance = $("#hot").handsontable('getInstance');
  112. </script>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="footer-text">
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <div id="outside-links-wrapper"></div>
  123. </body>
  124. </html>