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

Filtering and sorting on with the "Angular Way" deleting rows #300

Closed
fforres opened this issue Apr 26, 2015 · 3 comments
Closed

Filtering and sorting on with the "Angular Way" deleting rows #300

fforres opened this issue Apr 26, 2015 · 3 comments
Labels

Comments

@fforres
Copy link

fforres commented Apr 26, 2015

I reduced my code to the smallest version with the error.

The point is, I create a table, the angular way, with an empty array for the Table rows.

After that, I fetch some data, and add it to that same array (with angular.copy)

Even though they are correctly added to the table itself, if I click on a column title to sort it, or try to filter by typing in the input box, the table deletes all the rows.

I've created a codepen for this issue
http://codepen.io/forres/pen/WvbwPq?editors=101

@fforres
Copy link
Author

fforres commented Apr 26, 2015

I managed to isolate the issue
Created a different codepen for it
http://codepen.io/forres/pen/NqPrKQ?editors=101

The point is we where using $scope to save our different data & configurations, and I believe that by using "THIS" as the main variable, yo manage to keep the angular $digest working correctly.

I cant really say for sure, i'm not that much of an angular dev.
would love for @l-lin to enlighten us on this 😄

@l-lin
Copy link
Owner

l-lin commented Apr 26, 2015

Using this is just using the controllerAs with vm syntax. It's not the reason why it made it work.

I corrected your first pen in this pen. You just forgot to add the ng attribute to the datatables.

@fforres
Copy link
Author

fforres commented Apr 28, 2015

Thanks man!
:-)

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