我的项目是使用AngularJS + Kendo-UI.我正在尝试测试一个使用Kendo-UI Grid的控制器:
angular.module('myApp')('DevicesCtrl', function ($scope) {
$scope.gridOptions = {
dataSource: {
transport: {
read: {
url: "/devices",
dataType: "json"
}
},
change: function(){
var view = this.view();
$scope.devices = [];
$.each(view, function(i, v) {
$scope.devices.push({id: v.id, description: v.name, status: v.status == 0 ? "failure" : "success"});
});
$scope.$apply();
}
},
columns: [
{
field: "name",
title: "Name",
width: 250,
template: function (item) {
var itemStatus = item.status == 0 ? 'failure' : 'success';
return '<div label size="small" operation="' …Run Code Online (Sandbox Code Playgroud)