无效的模板 - 剑道网格

时间:2016-11-22 12:49:01

标签: jquery angularjs kendo-grid

加载我的Kendo Grid时会发生此错误。请帮帮我怎样才能修复它。

angular.js:13920 Error: Invalid template:'<tr data-uid="#=data.uid#" role='row'><td  role='gridcell'>#= kendo.toString(new Date(start Date /time), 'd') #</td><td  role='gridcell'><span ng-bind='dataItem.ramp'>#: data.ramp#</span></td><td  role='gridcell'><span ng-bind='dataItem.common Company Name'>#: data.common Company Name#</span></td><td  role='gridcell'><span ng-bind='dataItem.cargoMarket'>#: data.cargoMarket#</span></td><td  role='gridcell'><span ng-bind='dataItem.punctuality'>#: data.punctuality#</span></td><td  role='gridcell'>#= kendo.toString(new Date(arrival), 'd') #</td><td  role='gridcell'><span ng-bind='dataItem.location'>#: data.location#</span></td><td  role='gridcell'><span ng-bind='dataItem.carrier company'>#: data.carrier company#</span></td><td  role='gridcell'><span ng-bind='dataItem.range'>#: data.range#</span></td><td  role='gridcell'><span ng-bind='dataItem.bookingID'>#: data.bookingID#</span></td></tr>' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='<tr data-uid="'+(data.uid)+'" role=\'row\'><td  role=\'gridcell\'>'+( kendo.toString(new Date(start Date /time), 'd') )+'</td><td  role=\'gridcell\'><span ng-bind=\'dataItem.ramp\'>'+$kendoHtmlEncode( data.ramp)+'</span></td><td  role=\'gridcell\'><span ng-bind=\'dataItem.common Company Name\'>'+$kendoHtmlEncode( data.common Company Name)+'</span></td><td  role=\'gridcell\'><span ng-bind=\'dataItem.cargoMarket\'>'+$kendoHtmlEncode( data.cargoMarket)+'</span></td><td  role=\'gridcell\'><span ng-bind=\'dataItem.punctuality\'>'+$kendoHtmlEncode( data.punctuality)+'</span></td><td  role=\'gridcell\'>'+( kendo.toString(new Date(arrival), 'd') )+'</td><td  role=\'gridcell\'><span ng-bind=\'dataItem.location\'>'+$kendoHtmlEncode( data.location)+'</span></td><td  role=\'gridcell\'><span ng-bind=\'dataItem.carrier company\'>'+$kendoHtmlEncode( data.carrier company)+'</span></td><td  role=\'gridcell\'><span ng-bind=\'dataItem.range\'>'+$kendoHtmlEncode( data.range)+'</span></td><td  role=\'gridcell\'><span ng-bind=\'dataItem.bookingID\'>'+$kendoHtmlEncode( data.bookingID)+'</span></td></tr>';}return $kendoOutput;'
    at Object.compile (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:25:7888)
    at Object.proxy [as template] (http://lm.stage.cargoclix.net/bower_components/jquery/dist/jquery.js:497:14)
    at init._tmpl (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:50:28189)
    at init._templates (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:50:29776)
    at new init (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:48:28076)
    at HTMLDivElement.<anonymous> (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:26:4297)
    at Function.each (http://lm.stage.cargoclix.net/bower_components/jquery/dist/jquery.js:365:19)
    at jQuery.fn.init.each (http://lm.stage.cargoclix.net/bower_components/jquery/dist/jquery.js:137:17)
    at jQuery.fn.init.e.fn.(anonymous function) [as kendoGrid] (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:26:4274)
    at v (http://lm.stage.cargoclix.net/bower_components/kendo-ui/js/kendo.all.min.js:93:3354) <div kendo-grid="vm.grid" id="grid" k-data-source="vm.gridOptions.datasource" k-options="vm.gridOptions" class="lm-panel-body k-grid k-widget k-reorderable" data-role="grid">(anonymous function) @ angular.js:13920(anonymous function) @ angular.js:10467invokeLinkFn @ angular.js:9936nodeLinkFn @ angular.js:9335compositeLinkFn @ angular.js:8620compositeLinkFn @ angular.js:8623publicLinkFn @ angular.js:8500lazyCompilation @ angular.js:8844boundTranscludeFn @ angular.js:8637controllersBoundTransclude @ angular.js:9385ngIfWatchAction @ angular.js:26400$digest @ angular.js:17524$apply @ angular.js:17790done @ angular.js:11831completeRequest @ angular.js:12033requestLoaded @ angular.js:11966

看一看。 My Project Scree Shot

因此,发生了另一个错误,如下所示。 a

2 个答案:

答案 0 :(得分:0)

不确定,但您似乎需要在模板字符串中转义'或仅使用"

答案 1 :(得分:0)

这是在kendo字段中使用模板的正确方法, 你可能会遗漏一些单引号或双引号。请参考以下模板。

columns: [
      { field: "ID", hidden: true },
      { field: "Name", title: "Name", template: '<div title="#= (Name == null) ?  " " : Name #">#= (Name == null) ?  " " : Name #  </div>' },