This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
forked from handsontable/ngHandsontable
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
179 lines (156 loc) · 8.33 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!doctype html>
<html data-ng-app="ngHandsontablePage">
<head>
<meta charset='utf-8'>
<title>ngHandsontable.Angular version of Handsontable library</title>
<!-- Code highlighter -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="demo/css/main.css"/>
<!--
Loading Handsontable (full distribution that includes all dependencies)
-->
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="node_modules/handsontable/dist/handsontable.full.css">
<script data-jsfiddle="common" src="node_modules/angular/angular.js"></script>
<script data-jsfiddle="common" src="node_modules/handsontable/dist/handsontable.full.js"></script>
<script data-jsfiddle="common" src="dist/ngHandsontable.js"></script>
<script data-jsfiddle="common" src="demo/js/services/dataFactory.js"></script>
<!--
Facebook open graph. Don't copy this to your project :)
-->
<meta property="og:title" content="ngHandsontable - Angular wrapper for Handsontable">
<meta property="og:description" content="Excel-like data grid with HTML & JavaScript">
<meta property="og:url" content="http://handsontable.com/">
<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/">
</head>
<body class="home" data-ng-controller="MainCtrl as ctrl">
<div id="wrapper">
<header>
<h1>ngHandsontable</h1>
<h2 class="logo-desc">Angular wrapper for <a href="http://handsontable.com">Handsontable</a> data grid editor</h2>
<img class="angular" src="demo/images/angular@2x.png" alt="AngularJS">
</header>
<h2>Install</h2>
<br>
Install the component using Bower:
<pre><code class="bash">
$ bower install ngHandsontable --save
</code></pre>
using NPM:
<pre><code class="bash">
$ npm install ng-handsontable --save
</code></pre>
Or <a href="https://github.com/handsontable/ngHandsontable/archive/master.zip">download as ZIP</a>.
<h2>Usage</h2>
<br>
1. Include the library files:
<pre><code class="html">
<link rel="stylesheet" media="screen" href="bower_components/handsontable/dist/handsontable.full.css">
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/handsontable/dist/handsontable.full.js"></script>
<script src="bower_components/dist/ngHandsontable.js"></script>
</code></pre>
2. Start using it!
<pre><code class="html">
<hot-table datarows="db.items"></hot-table>
</code></pre>
<p>
<em>Note: ngHandsontable supports angular in version 1.3 and greater.</em>
</p>
<a href="https://github.com/handsontable/ngHandsontable" class="fork-me">
<img src="http://aral.github.com/fork-me-on-github-retina-ribbons/right-dusk-blue@2x.png" alt="Fork me on GitHub">
</a>
<h2>Simple Example</h2>
<div class="example">
<hot-table
settings="ctrl.settings"
row-headers="ctrl.rowHeaders"
min-spare-rows="ctrl.minSpareRows"
datarows="ctrl.db.items"
height="300"
width="700">
<hot-column data="id" title="'ID'"></hot-column>
<hot-column data="name.first" title="'First Name'" type="'text'" read-only></hot-column>
<hot-column data="name.last" title="'Last Name'" read-only></hot-column>
<hot-column data="address" title="'Address'" width="150"></hot-column>
<hot-column data="product.description" title="'Favorite food'" type="'autocomplete'">
<hot-autocomplete datarows="description in product.options"></hot-autocomplete>
</hot-column>
<hot-column data="price" title="'Price'" type="'numeric'" width="80" format="'$ 0,0.00'"></hot-column>
<hot-column data="isActive" title="'Is active'" type="'checkbox'" checked-template="'Yes'"
unchecked-template="'No'"></hot-column>
</hot-table>
</div>
<h2>Code</h2>
<pre><code class="html">
<hot-table
settings="ctrl.settings"
row-headers="ctrl.rowHeaders"
min-spare-rows="ctrl.minSpareRows"
datarows="ctrl.db.items"
height="300"
width="700">
<hot-column data="id" title="'ID'"></hot-column>
<hot-column data="name.first" title="'First Name'" type="'text'" read-only></hot-column>
<hot-column data="name.last" title="'Last Name'" read-only></hot-column>
<hot-column data="address" title="'Address'" width="150"></hot-column>
<hot-column data="product.description" title="'Favorite food'" type="'autocomplete'">
<hot-autocomplete datarows="description in product.options"></hot-autocomplete>
</hot-column>
<hot-column data="price" title="'Price'" type="'numeric'" width="80" format="'$ 0,0.00'"></hot-column>
<hot-column data="isActive" title="'Is active'" type="'checkbox'" checked-template="'Yes'"
unchecked-template="'No'"></hot-column>
</hot-table>
</code></pre>
<p>
The main directive for ngHandsontable is <b><hot-table></b>. To define columns you can use
<b><hot-column></b> directive inside <b><hot-table></b> directive.
All Handsontable <a href="http://docs.handsontable.com/Options.html">options</a> described in documentation should be supported.
</p>
<p>
You can put all your settings in settings object e.g. settings="{colHeaders: true, contextMenu: true}" attribute or in
separated attributes, e.g. min-spare-rows="minSpareRows", row-headers="false".
</p>
<p>
It's recommended to put all your settings in one big object (<code>settings="ctrl.settings"</code>).
Settings attribute unlike any other attributes is not watched so using this can be helpful to achieve higher performance.
</p>
<h2>More demos</h2>
<ul>
<li><a href="demo/index.html#/intro-simple-example">Simple example</a></li>
<li><a href="demo/index.html#/columns-add-remove-column-ng-repeat">Add/Remove dynamically column</a></li>
<li><a href="demo/index.html#/binding-data-binding">Data binding</a></li>
<li><a href="demo/index.html#/callbacks-callbacks-by-object">Callbacks</a></li>
<li><a href="demo/index.html#/pagination-rows-pagination">Pagination</a></li>
<li><a href="demo/index.html#/PRO-filtering-external-inputs">Data filtering</a></li>
<li><a href="demo/index.html#/PRO-collapsing-columns-with-nested-headers">Collapsing columns with nested headers</a></li>
<li><a href="demo/index.html">More...</a></li>
</ul>
<h2>PRO features</h2>
<br>
To install Handsontable PRO overwrite regular handsontable version with new one:
<pre><code class="bash">
$ bower install handsontable=git@git.handsontable.com:handsontable/handsontable-pro.git --save
</code></pre>
<i>If you don't have license for Pro yet, please click <a href="https://handsontable.com/pricing.html">here</a> for more info.</i>
<script>hljs.initHighlightingOnLoad();</script>
<script>
(function() {
function MainCtrl($scope, dataFactory) {
this.minSpareRows = 1;
this.rowHeaders = false;
this.db = {items: dataFactory.generateArrayOfObjects(10)};
this.settings = {colHeaders: true, contextMenu: ['row_above', 'row_below', 'remove_row']};
}
MainCtrl.$inject = ['$scope', 'dataFactory'];
angular.module('ngHandsontablePage', ['ngHandsontable']).controller('MainCtrl', MainCtrl);
}());
</script>
</div>
</body>
</html>