0
我使用的是NG重複循環中我的HTML頁面這樣如何使用ng-repeat在html頁面中動態創建多個ui網格?
<li class="list-group-item" ng-repeat="obj in Students">
<div class="grid" id="{{'grid'+$index}}" ui-grid="{{'griddata'+$index}}"
ui-grid-selection ui-grid-pagination>
</div>
</li>
這裏是我的腳本來創建UI電網動態
$scope.CreateGrids = function() {
debugger;
for (var count = 0; count < $scope.StudentList.length; count++) {
var studentData = "griddata"+count;
$scope[studentData] = [];
// defining the grid control
$scope[studentData] = {
enableRowSelection: false,
//grid pagination
paginationPageSizes: [10, 25, 50, 75],
paginationPageSize: 10,
enableSorting: true,
//enabling filtering
enableFiltering: false,
multiSelect: false,
//column definations
columnDefs: [
{ name: 'SubjectID', displayName: 'SubjectID', visible: false },
{ name: 'SubjectName', displayName: 'Subject Name' },
{ name: 'MarksObtained', displayName: 'Marks' },
]
};
$scope[studentData].data = $scope.StudentList[count].Student;
}
};
但如此多的命中和試用後,我無法創建網格。 我該如何實現它? 在此先感謝。
感謝賈揚特·..我將tr這個。 – Chandan