-
Notifications
You must be signed in to change notification settings - Fork 14
Loading HGrid with RequireJS
Steven Loria edited this page Feb 23, 2014
·
3 revisions
Assuming that jquery.js
, hgrid.js
, and a file called main.js
(shown below) are all in same directory static/js
, and the following index.html
file in the root directory:
<!DOCTYPE html>
<!-- index.html -->
<html>
<head>
<link rel="stylesheet" href="static/css/hgrid.css" type="text/css" />
</head>
<body>
<div class="hgrid" id="myGrid"></div>
<script data-main='static/js/main' src='static/js/require.js'></script>
</body>
</html>
You can load hgrid
like you would any other module.
// static/js/main.js
require(['hgrid'], function(HGrid) {
var grid = new HGrid('#myGrid', {
data: [{name: 'My Computer', kind: 'folder', children: []}]
});
});