1
votes

How do I initialize a Kendo.observable in a modular Backbone application that uses Require.JS? This is all new to me and it feels like swimming in mud.

My MAIN.JS file looks like this:

require.config({
    paths: {
        jquery: 'libs/jquery/jquery-min',
        underscore: 'libs/underscore/underscore-min',
        backbone: 'libs/backbone/backbone-optamd3-min',
        kendo: 'libs/kendo/kendo.web.min',
        text: 'libs/require/text',
        templates: '../templates'
    },
    shim: {
        kendo: {
            deps: ["jquery"],
            exports: "kendo"
        },
    }
});

require([ 'kendo', 'app' ], function(kendo, App){
    App.initialize();
});

And in one of my views I'm trying to create a Kendow.observable:-

define([
    'jquery',
    'underscore',
    'backbone',
    'kendo',
    'text!templates/newUser.html',
], function($, _, Backbone, kendo, newUserTemplate){
    var newUserView = Backbone.View.extend({
...
            var viewModel = kendo.observable({
...

Do I need to shim Kendo? I've got AMD versions of jQuery, Underscore and Backbone, so I don't think I need to shim these.

Do I need to define kendo.observable in the view? If so what should the definition look like?

And how do I instantiate Kendo controls?

Thanks - I'd really appreciate any help I can get with this.

1
can you explain what you're trying to accomplish with this? Why you're trying to get a Kendo MVVM Observable object in to a Backbone View? I'm not sure I can provide a meaningful answer without understanding that.Derick Bailey
We're creating a Backbone app, but a colleague has created a bunch of Kendo views outside Backbone and we're trying to import them. (Using a sledgehammer to crack a nut?) Thanks for any help.a11y_guru

1 Answers

0
votes

Well I haven't yet used Backbone so I don't know much about it. I do use a lot of Kendo and I know there is Kendo-Backbone integration project on GitHub that got some atention so maybe that can help?

https://github.com/kendo-labs/kendo-backbone

UPDATE: as for kendo and Require I shim it the same way you did, so that should be fine.