Closed johnico closed 7 years ago
Hello @johnico,
i think you mean with:
the problem is the page is stuck of course on the page
that you stuck on the page that you start with and not on the first page?
That is because you set the tableState.pagination.start
everytime the SmartTable callServer function is triggered.
So every time you try to go to the next page the tableState.pagination.start
is set to the url parameter again.
I think it should work if you wrapp it around a if statement to check if it's the first time the table is loaded
if(!$scope.firstLoadIsDone) {
tableState.pagination.start = **urlParams**;
$scope.firstLoadIsDone = true;
}
thx @MrWook . yes that what i meant , the state changed every time
I need that in the first time the table will paginate to the url param . and will update the param in every change until the next refresh
@MrWook do you know how can I do the same with the sort? to set default sort instead of hard code sort
@johnico
Is the problem fixed with my recommendation?
If my recommendation fixed the problem i would say that this should work for the sorting too:
if(!$scope.firstLoadIsDone) {
tableState.pagination.start = **urlParams**;
tableState.sort.predicate = **urlParams column**;
tableState.sort.reverse = **urlParams true or false**;
$scope.firstLoadIsDone = true;
}
@MrWook hi thx . its not working- i think because the function called twice Why the this.callserver called twice? I also checked and I have no ng-controller (defined in the route)
maybe its because the pagination or using st-sort-default directive. ? How can I solve it thx for the helping
Hi everything is working now with adding the following code:
.config([ 'stConfig', function(stConfig) { stConfig.sort.delay = 100; stConfig.pipe.delay = 200; }])
angular version- 1.5.10 smart table- latest version
HI I am trying to paginate the user to the page by keep the last page in the url I managed to save the "start" in the url - for example for page 2 i'm saving 20 and page 3 Im saving 30 ?startPage=20
and then I tried to set tablestate.pagination.start = 10 for exmaple the problem is the page is stuck of course on the same page
my Question i how can I the the param from the url and paginate the user to this page ( again I manages to keep the state and start param in every page) the problem is in the loading that i need to take from the url , and when paginate between page after I set the tablestate.pagination.start = param url
I don't want to use local storage cause I need it by url
thx a lot