私は Angular Ui-gridを使用しています。その中でマルチレベルのネストを実現しようとしています。uiGrid githubですでに問題を提起している人もいます。しかし、その解決策は機能していないようです。
このように JSON を変更しました。ネストされたサブグリッドを形成しようとしています。
以下は私のコードです
$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;
});
および第 2 レベルのネストされた html(expandableRowTemplate1.html) は次のようになります
<div ui-grid="row.entity.subNestedGridOptions" style="height:150px;"></div>
第 2 レベルのネストされたグリッドの ui-grid にデータを渡すと、undefined がスローされます。
2 つまたは 3 つ以上のレベルで Expandable UI Grid を実装することに成功した人はいますか。はいの場合は、プランカーまたはフィドルを共有してください。詳細な説明は本当に役に立ちます!