ng-table icon indicating copy to clipboard operation
ng-table copied to clipboard

How to save the state of the table even on hard refresh?

Open r04drunn3r opened this issue 10 years ago • 0 comments

I am using Ng-table to show humungous amount of data I get from a REST API.

The Problem

Since there is a lot of data, I apply a lot of filters and sorting in the table. I want the table state to remain in the same way even on a hard refresh.

Possible Solutions

I know there are two ways I can do it.

1.By saving the ngTableparams to the local storage and retrieving it.

2.By storing all the filter and sorting parameters in the URL itself.

Unfortunately both the options are not at all documented in the Ng-table documentation and I'm not able to move forward.

$scope.tableParams = new NgTableParams(angular.extend({ page: 1, count: 25, sorting: { Id: "asc" } }, $location.search()), { total: 0, counts: [5, 10, 25, 50], getData: function ($defer, params) { if (!firstLoad) { $location.search(params.url()); } firstLoad = false; $defer.resolve(data); } });

But this is throwing the following errors: $defer.resolve is not a function Cannot read property 'url' of undefined

What am I doing wrong here?

r04drunn3r avatar Nov 21 '16 12:11 r04drunn3r