I am a beginner in angularJS and I have a requirement to hide a row in my ng-grid
table if the value of a column is '0'.
The grid
consists of 4 columns:
- User
- Today
- This Week
- This Month
I need to hide an entire row if the value in the 'This Month' column is '0'
The HTML for the grid
is as follows:
<div data-ng-controller="workflowworkitemscompleted as vm">
<div data-ng-if="isbusy">
<div data-cc-spinner="vm.spinnerOptions"></div>
</div>
<div class="row">
<div class="col-md-12">
<div class="gridStyle" style="height:157px" data-ng-grid="gridOptions" id="cwigrid"></div>
</div>
</div>
</div>
The controller code is shown below:
$scope.searchfilter = "";
$scope.mySelections = [];
$scope.sortInfo = { fields: ['countDay'], directions: ['desc'] };
$scope.totalServerItems = 0;
$scope.pagingOptions = {
pageSizes: [5],
pageSize: 5,
currentPage: 1
};
$scope.gridOptions = {
data: 'wfiprocessed',
multiSelect: false,
rowHeight: 25,
showFooter: false,
footerRowHeight: 40,
enableColumnReordering: false,
showColumnMenu: false,
enableColumnResize: false,
enableRowSelection: false,
filterOptions: $scope.filterOptions,
selectedItems: $scope.mySelections,
enablePaging: false,
pagingOptions: $scope.pagingOptions,
plugins: [gridLayoutPlugin],
totalServerItems: 'totalServerItems',
sortInfo: $scope.sortInfo,
useExternalSorting: false,
virtualizationThreshold: 50,
rowTemplate: "<div ng-style=\"{ 'cursor': row.cursor }\" ng-repeat=\"col in renderedColumns\" class=\"ngCell {{col.colIndex()}} {{col.cellClass}}\">" +
" <div class=\"ngVerticalBar\" ng-style=\"{height: rowHeight}\" ng-class=\"{ ngVerticalBarVisible: !$last }\"> </div>" +
" <div ng-cell></div>" +
"</div>",
columnDefs: [
{ field: 'userName', displayName: 'User', cellTemplate: vm.optimizedcell },
{ field: 'countDay', displayName: 'Today', cellTemplate: vm.optimizedcell },
{ field: 'countWeek', displayName: 'This Week', cellTemplate: vm.optimizedcell },
{ field: 'countMonth', displayName: 'This Month', cellTemplate: vm.optimizedcell }
]
};
The table displays like this:
After analyzing the table, it is clear that the 'dtealdev' or 'qauser2' rows should not be visible as the 'This Month' column value is '0'