如果我有多个ng-grid(不是ui-grid)的多个数据源,我如何将它们分配给每个ng-grid配置?
例如:
$scope.myData['set1'] = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
$scope.myData['set2'] = [{name: "Moroni", age: 50}];
我想按照以下方式做点什么:
var gridOptions1 = {
data: ('myData[' + 'set1' + ']'),
columnDefs: [
{ field:"name", displayName: "NAME"},
{ field:"age", displayName: "AGE"}],
multiSelect: true,
selectedItems: $scope.selected
};
var gridOptions2 = {
data: ('myData[' + 'set2' + ']'),
columnDefs: [
{ field:"name", displayName: "Name"},
{ field:"age", displayName: "Age"}],
multiSelect: false,
selectedItems: $scope.selected
};
我想要这样做的原因是因为我有一个动态形式,可能有不同数量的ng-grid(基于使用者输入),所以我需要确保每个网格都必须纠正其中的数据。 / p>
答案 0 :(得分:0)
我想我弄清楚了我的错误。 set1和set2应该用单引号中的双引号括起来。