-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequire.config.js
61 lines (56 loc) · 2.02 KB
/
require.config.js
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
/*
* KnockoutJS Nested DataTable custom element
* Version: 0.1
*
* Copyright 2015 Shailendra Kumar.
* All Rights Reserved.
* Use, reproduction, distribution, and modification of this code is subject to the terms and
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
*
* Author: Shailendra Kumar
*/
(function(){
'use strict';
/* Require JS Config and index.html page view modal*/
require.config({
paths: {
jquery: "bower_components/jquery/dist/jquery.min",
knockout: "bower_components/knockout/dist/knockout",
"datatables": "bower_components/datatables/media/js/jquery.dataTables.min",
//Require JS dependencies
text: "bower_components/requirejs-text/text",
nesteddatatableKO: "src/ko-nested-datatable",
data: "src/data"
},
shim: {
'datatables': {
deps: ['jquery'],
exports: 'dataTable'
}
}
});
require(["jquery","knockout","datatables","text","nesteddatatableKO","data"]);
define(function(require) {
var ko = require('knockout'),
ndt = require('nesteddatatableKO'),//load ko-nested-datatable.js file
data = require('data');// get table data from data.js file
//outer datatable configuration
var outerConfig = {
"sPaginationType": "full_numbers",
"bRetrieve": true,
"bDestroy": true,
"aaSorting": [[1, "asc"]]
};
//inner datatable configuration
var innerConfig = {
"aaSorting": [[2, "asc"]]
};
var pageViewModel = function(){//supply data from page view model to ko-nested-datatable custom element
var self = this;
self.tableData = data;
self.outerDefaults = outerConfig;
self.innerDefaults = innerConfig;
};
ko.applyBindings(new pageViewModel()); //apply knockout bindings to page
});
})();