刚接触Kendo,我很难在Kendo网格中显示我的JSON数据。如果我通过普通的html表引用我的$scope.actionData,我就能够在页面中查看它。
最终,我将尝试完成this
列标题显示在页面上,但其下方没有数据。
当我试图填充Kendo网格时,我可以通过DataSource -> Options -> data array中的Chrome kendo UI Inspector看到我想要的数据,但是我不知道如何让它显示在页面上,而且它没有填充DataSource ->数据数组。我尝试过angular-kendo页面上的示例,但没有成功。我还尝试在html中的div下添加各种元素/标记,但我又回到了开始的地方。
如果我还需要添加任何东西,请告诉我。我们非常感谢任何帮助我们实现这一点的方法。提前感谢!
HTML:
<div kendo-grid k-data-source="gridOptions"></div>控制器:
var actionHistoryControllers = angular.module('actionHistoryControllers', ['kendo.directives'])
.controller('ActionHistoryCtrl', ['$scope', '$routeParams', 'ActionHistory',
function ($scope, $routeParams, ActionHistory) {
$scope.actionData = ActionHistory.query({ appid: $routeParams.appid },
function (data) {
$scope.error = false;
$scope.errorMsg = "";
},
function (data) {
$scope.error = true;
$scope.errorMsg = "<strong>Unable to load!</strong> Please reload the page.";
});
$scope.gridOptions = {
data: $scope.actionData,
columns: [
{field: "UserID", title: "User ID"},
{field: "ActionText", title: "Action Text"}]
}
}])Chrome Kendo UI Inspector:
Data source
options: Object{9}
data: Array[3]
0: Object{17}
ActionHistoryID: 315911
ActionText: "System"
...发布于 2014-08-08 15:20:35
请替换以下内容:
$scope.gridOptions = {
data: $scope.actionData,
columns: [
{field: "UserID", title: "User ID"},
{field: "ActionText", title: "Action Text"}]
}具有以下功能:
$scope.gridOptions = {
dataSource: {
transport: {
read: function (o) {
o.success($scope.actionData);
}
},
columns: [
{field: "UserID", title: "User ID"},
{field: "ActionText", title: "Action Text"}]
}
}https://stackoverflow.com/questions/24934514
复制相似问题