Backbone.js 在主干、require、下划线和剑道上使用剑道ui网格

Backbone.js 在主干、require、下划线和剑道上使用剑道ui网格,backbone.js,underscore.js,requirejs,kendo-ui,Backbone.js,Underscore.js,Requirejs,Kendo Ui,我如何使用剑道ui网格、backbone.js、下划线.js和require.js加载或实例化剑道ui网格?是否可能 define([ 'jquery', 'underscore', 'backbone', 'text!templates/cart/cartlist.html' ], function($, _, Backbone, CartListTemplate){ var mainHomeView = Backbone.View.extend({ el: $("#cartContaine

我如何使用剑道ui网格、backbone.js、下划线.js和require.js加载或实例化剑道ui网格?是否可能

define([
'jquery',
'underscore',
'backbone',
'text!templates/cart/cartlist.html'
], function($, _, Backbone, CartListTemplate){

var mainHomeView = Backbone.View.extend({
el: $("#cartContainer"),
render: function(){
  $("#grid").kendoGrid({
    columns: ["ItemDescription", "Qty", "Price", { command: "destroy" }],
  });
  this.el.html(CartListTemplate);
}
});
 return new mainHomeView;
});
还有这个

CartListView.render();

但它不起作用。它没有出现。有什么想法吗?

作为一般参考,我写了一篇关于使用带主干的jQuery插件的博文,并多次提到KendoUI是我首选的控制套件:

要具体回答您的问题,渲染方法中有一个错误

当您调用
$(“#grid”).kendoGrid(…)
,您告诉jQuery在页面的DOM中查找
#grid
元素,但该元素还不存在,因为它来自您的
CartListTemplate
。设置视图的
el.HTML
后,您需要使用
this.$
在视图的HTML中查找
#网格


render: function(){
  this.$el.html(CartListTemplate);
  this.$("#grid").kendoGrid(...);
}