Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Order double render and ajax request twice #1170

Closed
tschleuss opened this issue Jan 31, 2018 · 4 comments
Closed

Order double render and ajax request twice #1170

tschleuss opened this issue Jan 31, 2018 · 4 comments
Labels
Help wanted stale Used to close issues for inactivity (by bot)

Comments

@tschleuss
Copy link

tschleuss commented Jan 31, 2018

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request

What versions you are using?


- angular version: 1.5.0
- jquery version: 2.2.0
- datatables version: 1.10.16
- angular-datatables version:  0.6.2 or 0.6.3-dev

Current behavior

Like mentioned in #295 when I pre-sort my table by its first column, every time I re-order that column it calls my back-end twice. There are two requests, and a strange flickering occurs.

Expected behaviour

I think that just one request should be made, and that flickering should not happen.

Minimal reproduction of the problem with instructions

I tried to use some online tool like plnkr or codepen, but was unable to do because I need to make a call without JSONP. Here you can find a mini-project that I made based on a previous pen provided by the author of this project on #295.

I found it strange that the code in the pen works without a problem because the code on my project it's almost the same. I tried to reproduce my problem outside of my project but was unable, until today, and the motive maybe can help to find the problem.

I noticed that in the pen above, the data requested from the server is made by a jquery ajax call. In my project and in my demo I use angular's $http.get to retrieve what I need.

So, we have a few points:

  • If I don't pre-order my table by one column, this problem doesn't occur.
  • If I use jquery ajax to retrieve my data, this problem doesn't occur either.
  • If I pre-order my table and use a $http.get to retrieve the data, the request is made twice (even for the language json file url).
  • If I order my table by its second column, the first one doesn't trigger this problem anymore.
@l-lin
Copy link
Owner

l-lin commented Feb 4, 2018

Mmh, yes it's weird... When you are using the $http.get, you will get double request.
However, if you use the jQuery.ajax instead, you will only get one call. Maybe there is something about angularjs digest cycles 🤔

@androidparth90
Copy link

I am also using $http.get and my table flickers for like 3 seconds during the binding of data. Is this has to do with $http.get? Will it get resolved if I use jquery ajax

@stale
Copy link

stale bot commented Dec 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Used to close issues for inactivity (by bot) label Dec 6, 2020
@stale
Copy link

stale bot commented Dec 13, 2020

This issue has been closed due to inactivity. Please feel free to re-open the issue to add new inputs.

@stale stale bot closed this as completed Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help wanted stale Used to close issues for inactivity (by bot)
Projects
None yet
Development

No branches or pull requests

3 participants