esvit / ng-table

Simple table with sorting and filtering on AngularJS
http://esvit.github.io/ng-table
BSD 3-Clause "New" or "Revised" License
2.77k stars 851 forks source link

data range filter #979

Open whitmanlui opened 7 years ago

whitmanlui commented 7 years ago

hi, how can i use angularjs to add a range filter? (programmatically)

anuja-joshi commented 7 years ago

@whitmanlui You will have to add custom filter to enable range filter. Check - Customize filter algorithm Example , Example with filtering by age has range filtering.

whitmanlui commented 7 years ago

but i cannot do like this Change filter values programmatically do you have some example? thx my code:

    $scope.changeFilter = function () {
        var filter = {};
        if ($scope.username != "") {
            filter['username '] = $scope.username;
        }
        if ($scope.ageFrom< $scope.ageTo) {
            //range filter setting
        }
        $scope.tableParams.filter(filter);    
    };

i would like to change or add the range filter here when i click the button