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

st-pipe with default-sort-column causes double xhr request when initializing table. #734

Closed wzoet closed 7 years ago

wzoet commented 7 years ago

Hi,

We are working with your plugin which is really awesome. We just found that when having a default-sort field set to true, the pipe is called twice, causing data be loaded twice upon initializing of the page.

It is totally not a showstopper, but I guess it isn't very efficient as well.

We use angular ˆ1.5.8 and angular-smart-table ˆ2.1.8.

Thanks for your effort in this plugin!

MrWook commented 7 years ago

Hello @wzoet,

i read this "issue" quite often here:

329

388

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; }]);