私は角度Ui-gridを使用しています。その中で複数レベルのネストを達成しようとしています。すでにuiGrid githubに問題を提起している人もいます。しかし、その解決策は動作していないようです。角度Ui-Gridマルチレベルネスト
JSONをthisのように変更しました。私はネストされたサブグリッドを形成しようとしています。以下は
私のコード
$scope.gridOptions = {
expandableRowTemplate: 'expandableRowTemplate.html',
enableGridMenu: true,
expandableRowHeight: 150,
paginationPageSizes: [5, 10, 15],
paginationPageSize: 5,
//subGridVariable will be available in subGrid scope
expandableRowScope: {
subGridVariable: 'subGridScopeVariable'
}
}
$scope.gridOptions.columnDefs = [
{ name: 'id', enableHiding: false },
{ name: 'name' },
{ name: 'age' },
{ name: 'address.city' }
];
$http.get('http://private-7a7085-getfriends1.apiary-mock.com/getfriends')
.success(function (data) {
for (i = 0; i < data.length; i++) {
//for(i = 0; i < 50; i++){
data[i].subGridOptions = {
columnDefs: [{ name: "Id", field: "id" }, { name: "Name", field: "name" }, { name: "Age", field: "id" }, { name: "Address", field: "name" }],
data: data[i].friends,
expandableRowTemplate: 'expandableRowTemplate1.html',
enableGridMenu: true,
expandableRowHeight: 150
}
for (j = 0; j < data[i].friends.length; j++) {
data[i].subNestedGridOptions = {
columnDefs: [{ name: "Id", field: "id" }, { name: "Name", field: "name" }, { name: "Age", field: "id" }, { name: "Address", field: "name" }],
data: data[i].friends[j].friends
}
}
}
$scope.gridOptions.data = data;
});
と第二のレベルのネストされたHTML(expandableRowTemplate1.html)は
<div ui-grid="row.entity.subNestedGridOptions" style="height:150px;"></div>
私が第2レベルのネストされたグリッドのUIグリッドにデータを渡すと、それはスローのように見えています未定義。
2つまたは3つ以上のレベルの拡張可能なUIグリッドを実装することが今まで成功していますか。はいの場合は、プランナーやフィドルを共有してください。詳細な説明は本当に役に立ちます!
例のためにプランナーを作成してください – ShaMoh