lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

Angular Smart Table Reload Data and Reset Filters Along With Pagination(Without st-pipe) #716

Closed nimanthaharshana closed 7 years ago

nimanthaharshana commented 8 years ago

I have the smart table with Ajax loaded data where I want to reset filters and reload my data collection with reset of pagination as well when a button is clicked. My code is given below.

HTML

<button ng-click="resetFilters();" type="button" class="btn btn-info">Reset</button>

JS


$scope.resetFilters = function () {
            $scope.rowCollection = [];
            $scope.displayedCollection = [];
            $scope.product_type = null;
            $scope.product_category = null;
            $scope.search = null;
            $scope.rowCollection = new_data;
        };

However I can't get this managed since pagination and filters are not resetting.

I have seen the following but I'm not sure how actually the tableState Object can be accessed since it's undefined when I log it on the console and also I'm not using st-pipe directive.

tableState = ctrl.tableState()
tableState.search.predicateObject = {}
tableState.pagination.start = 0

Please Help...

Thank You.

MrWook commented 8 years ago

Hello @nimanthaharshana what i know is that tableState is a parameter for the st-pipe directive so it isn't usefull for you.

nimanthaharshana commented 8 years ago

Thank You @MrWook... I'm still looking for a solution, but no luck... :-(