I am building an application with Durandal to connect with PhoneGap. When I try to start the weyland optimizer, I have some problems. The assembly and optimization are error-free (I use requirejs as an optimizer), but when I run the application, my kendo ui diagram throws an error "Uncaught TypeError: Object [object Object] does not have a method of" kendoChart ".
If I pause in debug mode in chrome where kendoChart is bound and type "kendo" in the console, I get kendoobject and can view its properties, etc., so it is definitely in the DOM.
Iv'e google quite a lot and found some topics here, but none of them seemed to sort my problem. For example, this stream or this .
I have a knockout binding for the chart below.
My weyland.config is as follows:
exports.config = function (weyland) {
weyland.build('main')
.task.jshint({
include: 'App/**/*.js'
})
.task.uglifyjs({
})
.task.rjs({
include: ['App/**/*.{js,html}', 'Scripts/custom/**/*.js', 'Scripts/jquery/*.js', 'Scripts/durandal/**/*.js'],
exclude: ['Scripts/jquery/jquery-2.0.3.intellisense.js', 'App/main.js'],
loaderPluginExtensionMaps: {
'.html': 'text'
},
rjs: {
name: 'main',
baseUrl: 'App',
paths: {
'text': '../Scripts/text',
'durandal': '../Scripts/durandal',
'plugins': '../Scripts/durandal/plugins',
'transitions': '../Scripts/durandal/transitions',
'knockout': '../Scripts/knockout/knockout-2.3.0',
'kendo': 'empty:', <-- tried refering kendo.all.min, or dataviz.chart or the path
'jquery': '../Scripts/jquery/jquery-2.0.3.min',
'Helpers': '../Scripts/custom/helpers',
........ other scripts ......
},
deps: ['knockout', 'ko_mapping', 'command'],
callback: function (ko, mapping, command) {
ko.mapping = mapping;
}
inlineText: true,
optimize: 'none',
pragmas: {
build: true
},
stubModules: ['text'],
keepBuildDir: false,
out: 'App/main-built.js'
}
});
};
define([
'knockout',
'jquery',
'Helpers',
'kendo/kendo.dataviz.chart.min'
], function (
ko,
$,
helpers,
kendoui
) {
function drawChart(element, values, options) {
$(element).kendoChart({ **<-- this is where I get an error**
... options for chart ...
});
}
ko.bindingHandlers.moodChart = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
kendo.dataviz.ui.Chart.fn.options.renderAs = "svg"; **<-- this renders no errors**
if (kendo.support.mobileOS) {
kendo.dataviz.ui.Chart.fn.options.renderAs = "canvas";
}
var values = ko.unwrap(valueAccessor());
setTimeout(function () {
drawChart(element, values);
}, 125);
}
};
});
I would add that everything works fine, working with non-optimized code in a web browser (or on the phone, for that matter).
I also tried faking the kendo path in the configuration file and adding a dependency to jquery, which really doesn't make any difference.
Any help would be appreciated!