我已将一个名为State的列声明为enum,其中包含4个值:None(默认值),Updated,New和Delete。
我放了一个名为“Acciones”的列按钮,当我点击该按钮时,这会调用一个将State的值更改为“Delete”的事件,我希望在发生这种情况时隐藏该行但过滤选项不起作用。
这是我的代码:
$scope.stateCRUD = {
0: 'None',
1: 'New',
2: 'Delete',
3: 'Update'
};
$scope.filterOptions = {
filterText: 'state:Delete',
useExternalFilter: true
};
$scope.gridOptionsDetailCurvaOriginal = {
data: 'detailCurvaOriginalList',
columnDefs: [
{ field: 'objetoItem', displayName: 'Item', width:'130px', cellClass: 'grid-align', visible: false},
{ field: 'ejercicio', displayName: 'Ejer', width: '12%', cellClass: 'grid-align', enableCellEdit: $scope.canEdit(), resizable: true },
{ field: 'importe', displayName: 'Importe', width: '20%', cellClass: 'grid-align', enableCellEdit: $scope.canEdit() },
{ field: 'state', displayName: 'State', width: '130px', cellClass: 'grid-align', visible: true },
{ displayName: 'Acciones', width: '12%', cellClass: 'grid-align', cellTemplate: '<div class="ng-grid-icon-container"><a href="javascript:void(0)" class="btn btn-rounded btn-xs btn-icon btn-default" ng-click="DeleteItemCurvaOriginal(row)"><i class="fa fa-close"></i></a></div>' }
],
showFooter: true,
enableRowSelection: true,
filterOptions: $scope.filterOptions,
multiSelect: false,
enableCellEditOnFocus: false,
selectedItems: $scope.mySelections,
totalServerItems: 'detailCurvaOriginalTotalItems',
beforeSelectionChange: function (data) { $scope.idRowSelectedCurvaOriginal = data.rowIndex; },
jqueryUITheme: false
};
$scope.DeleteItemCurvaOriginal = function (row) {
$scope.detailCurvaOriginalList[row.rowIndex].state = $scope.stateCRUD[2];
};