我尝试按日期过滤网格
$scope.filterDate = function () {
$scope.state = $scope.gridApi.saveState.save();
if ($scope.state.columns[3].filters.length != 0) {
$scope.state.columns[3].filters.length = 0;
};
// Try 1
$scope.state.columns[3].filters.push({ condition: function(cellvalue) {
return $scope.filter.startDate >= cellvalue;
}
});
//Try 2
$scope.state.columns[3].filters.push({ term: $scope.filter.endDate, condition: uiGridConstants.filter.LESS_THAN });
$scope.gridApi.saveState.restore($scope, $scope.state);
}
但这两次尝试并没有真正起作用。有人得到了一个例子还是可以帮助我?
答案 0 :(得分:0)
当我通过代码切换列可见时,我遇到了saveState.restore的问题。
我使用$ timeout解决了它...也许它也会帮助你:
$timeout(function () {
$scope.gridApi.saveState.restore($scope, $scope.state);
});