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

How should you do changeData on $interval for 0.5.1? #528

Closed
hilhorst opened this issue Nov 30, 2015 · 5 comments
Closed

How should you do changeData on $interval for 0.5.1? #528

hilhorst opened this issue Nov 30, 2015 · 5 comments
Labels
Milestone

Comments

@hilhorst
Copy link

I set up my controller to get dtInstance through the two-way data binding as described in the v0.4.3 release notes. When I add the following statement to the controller function (to do an automatic update of the table contents every 5 seconds) you see the "Loading..." message instead of the current contents of the table, and half of the time the vm.dtInstance object is logged as Object {}.

    $interval(function(){
            console.log(vm.dtInstance);
            if (typeof vm.dtInstance.changeData === 'function') vm.dtInstance.changeData( myPromise );
     }, 5000);

What would be the proper way to automatically update the contents of the table? Is this still possible in 0.5.1?

@l-lin
Copy link
Owner

l-lin commented Nov 30, 2015

Can you share your full code?

@hilhorst
Copy link
Author

hilhorst commented Dec 1, 2015

I'm stripping all things unrelated from my app so I can make a Plunk for it. This seems to be more work than I anticipated, but I hope to have one set up tomorrow.

@hilhorst
Copy link
Author

hilhorst commented Dec 2, 2015

I made a Plunk that shows the issue. On v0.5.0 the table is updated after the promise is resolved, on v0.5.1 the table is replaced with the "Loading..." until the promise is resolved. I built in an ugly delay to simulate the delay on the $resource call to emphasize the issue.

I put both in the same plunk. Only the version of angular-datatables is different, so other than the html file both are equal.

http://plnkr.co/edit/6uJZfn?p=preview

@l-lin
Copy link
Owner

l-lin commented Dec 2, 2015

Mmh seems to be a regression from #355... 😞

Thanks for reporting it.

@l-lin l-lin added the bug label Dec 2, 2015
@l-lin l-lin added this to the v0.5.2 milestone Dec 2, 2015
@l-lin l-lin closed this as completed Dec 2, 2015
@hilhorst
Copy link
Author

hilhorst commented Dec 2, 2015

Wow, you're quick 😄 Thanks, it works like a charm, now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants