-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
st-pipe function is being called twice in a row #329
Comments
Most of the directives trigger a call to pipe function whenever the table state change, normally it is one shot but there could be side effects. Can you show me what your table look like ? |
Please take a look at: I've built this base on you ajax plugin example. |
yep you are right, I think the pagination directive when linking changes somehow the tableState define here which triggers a call to pipe function (the first one is from the post link function of the main directive). I need to investigate a bit more. Meanwhile, as a workaround, I suggest you cache you http request or check manually in you custom pipe function to avoid duplicate call for what should be the same tableStae |
meanwhile as a solution we have a flag in place. |
I'm experiencing this too! |
Samething here. |
Just found out that it's not just st-pagination but also st-sort-default. @ version 2.0.1. |
Confirmed. pagination and st-sort-default do this. :( So I am now using something like: ...
if (angular.equals(tableState, this.previousTableState)) return;
this.previousTableState = angular.copy(tableState);
... |
@lorenzofox3, what will one do if one desires to override your default pipe / sort by behavior ? how can i extend on your controller ? Say i want to add a multi-sort client side, i need a way to override pipe. overriding sortBy is easy because you have only tableState variable to worry about and you have a method to get that. but pipe has several others variables... |
Issue is still happening in version 2.1.6, same use case. |
Yes, using version 2.1.6 and it's still happening. |
It still happening when included st-pagination. (version 2.1.7) |
I just updated smartTable to 2.1.8 and i still have 2 calls. The first without sort and the second with sort. I am using st-sort-default directive. |
Removing |
I had debugged this issue and resolved it.
Solution: |
I updated smart table to the latest version, but still having this issue with st-sort-default directive. I found an alternative solution. A bit hackish, sorry :(
|
I was trying to implement persistence tableState for ajax call and seems restoring tableState will cause pipe function being called twice as mention here. Is there any fix in plan? |
What is workaround or fix for this? |
Refer to MrWook's reply in issue 734, Probably the problem occurs when you use sort with the pipe directive and like i said in #388 I used my previous answer for a while and find out that it destroy my Table page caching system so I decided to increase the pipe delay to 400ms. I really don't like this because i see this delay maybe not the customer but i see it. Now i was thinking about the reason behind it why the increase of the delay fixed this issue. I decided to look throw the SmartTable.js file and i saw that the sorting have a delay to so i decrease the delay from the sorting and set the delay from the pipe right above it. The pipe delay need to be higher than the sort delay To provide you with some more help: app.config([ 'stConfig', function(stConfig) { stConfig.sort.delay = 100; stConfig.pipe.delay = 200; }]); |
solved my issue too |
Added parameter to the sort function which is only be used for the sortDefault behaviour for the first call. To fix the problem that the pipe called twice
Not really sure whats going on but st-pipe function is being called twice in a row which isnt ideal,
The text was updated successfully, but these errors were encountered: