I am following an example here to create dataTables in a SPA using durandal and knockout js and requirejs. I keep getting an error "Cannot read property 'dataTable' of undefined ". My viewModel looks like so:
define(['knockout', 'jqueryData', 'datacontext'],
function (ko, jqueryData,dtx) {
function activate() {
var testData = dtx.dataSets();
$('#demo').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');
$('#example').dataTable({//Error here: dataTable undefined
"data": dtx.dataSets(),
"columns": [
{ "title": "Engine" },
{ "title": "Browser" },
{ "title": "Platform" },
{ "title": "Version", "class": "center" },
{ "title": "Grade", "class": "center" }
]
});
return;
}
var compositionComplete = function () {
}
var vm = {
activate: activate,
compositionComplete: compositionComplete
};
return vm;
});
in my main.js i have :
'jqueryData': '../scripts/jquery.dataTables',
Any pointers on what i am missing. Thanks