javascript – 如何将Kendo-grid用于Angular-ngRepeat
作者:互联网
如何为ng-repeat的每次迭代生成具有不同数据的kendo-grid?
HTML代码:
<div ng-repeat="PricesPerGroup in AllGroups">
<kendo-grid options="GridOptions"></kendo-grid>
</div>
JavaScript代码:
$scope.GridOptions = {
dataSource: {
data: {
(data is current 'PricesPerGroup' - Should bring it from ng-repeat)
}
}
}
解决方法:
尝试使用将返回正确的配置对象的辅助函数:
<div ng-repeat="PricesPerGroup in AllGroups">
<kendo-grid options="getGridOptions(PricesPerGroup)"></kendo-grid>
</div>
在控制器中:
$scope.getGridOptions = function(data) {
return {
dataSource: {
data: data
}
};
};
演示:http://dojo.telerik.com/eFaXA
标签:javascript,angularjs,kendo-grid 来源: https://codeday.me/bug/20190728/1558921.html