ag-grid のグループ化を使用して、複数のレベルの貸借対照表を表示しようとしています。それは機能しますが、データにnull
は階層がレベルをスキップする場所があり、これらの行を非表示にしたい-例:
Level0 - Level1 - Level2 - AccountName - Value Assets - null - null - Cash - $10,000 Liabilities - Payables - Short Term - Invoices - $5,000
したがって、私のグリッドでは、Liabilities
階層は問題ないように見えますが、Assets
階層にはとnull
の間に 2 つのレベルがAssets
ありCash
ます。行を非表示にしたいnull
。添付の写真を参照してください:
ここでNiallが言及した構成を使用して、これを機能させようとしています:
<div ng-grid="gridOptions" ng-show="gridOptions.rowData.length>0"/>
また:
<div ng-grid="gridOptions" ng-if="gridOptions.rowData.length>0"/>
しかし、私のrowData
はではなくnull
、groupColumnDef
です。
/に必要gridOptions.rowNode.data
ですか? これを解決する方法がわかりません。ng-if
ng-show
コントローラーのコードは次のとおりです。
(function () {
'use strict';
angular
.module('app')
.controller('BalShtController', BalShtController);
BalShtController.$inject = ['$scope', '$http'];
function BalShtController($scope, $http) {
$scope.title = 'Balance Sheet';
var columnDefs = [
{ headerName: "No.", field: "GlNumber", sort: 'asc', hide: 'true' },
{ headerName: "Value", field: "Value", cellRenderer: currencyFormat, cellStyle: currencyCssFunc, width: 200 }
];
$scope.gridOptions = {
columnDefs: columnDefs,
rowData: null,
enableFilter: true,
enableColResize: true,
onReady: function () {
$scope.gridOptions.api.sizeColumnsToFit()
},
groupKeys: ['GlPartnerLevel1', 'GlPartnerLevel2', 'GlPartnerLevel3', 'GlPartnerLevel4', 'GlName'],
groupAggFields: ['Value'],
groupDefaultExpanded: 3,
groupIncludeFooter: true,
groupColumnDef: {
headerName: "Detail",
field: "TxTransactionDate",
width: 300,
cellRenderer: {
renderer: 'group',
footerValueGetter: '"Total (" + x + ")"',
padding: 5
}
},
};
$http.get("http://localhost:39016/api/BalanceSheet")
.then(function (res) {
$scope.gridOptions.api.setRowData(res.data);
});
}
})();