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

Problem with multiple datatables 'ng' and changing content on one (Node Error) #309

Closed
SeoRoman opened this issue May 13, 2015 · 3 comments

Comments

@SeoRoman
Copy link

It's hard for me to write a mockup, but I can easily explain the situation...

First ( I have a datables of employees ), this works fine on it's own...

second, on edit employee, I open Bootstraps Modal, which has some tabs, one of which is for "Logins" this is another datatable...

Both datatables are 'ng' and using $scope.employees on one and $scope.employee_logins on another...

My issue, is when I update an employee (without touching the logins table...) I use the code provided on the site "the angular way"

EmployeeFactory.employees.splice(index, 1, newEmployee); // this works great, but I get an error

Node was not Found due to the second table for some reason, trying to re-render (don't know why...)

Both tables work fine on their own, but once they are on the same page opened at the same time, the instances just don't matter.

I would think that 'ng' would solve the issue of which one to reload, however it looks like the only way to fix this issue presently, is to move to a non-ng issue and do everything manually... Which is something I would like to avoid.

@SeoRoman
Copy link
Author

Update:

I looked into Line 592 on angular-datatables.js ...

contains the following code:
if (!remove && orig) {
// insertBefore acts like appendChild if !arg[1]
try {
orig.insertBefore(table, settings.nTableReinsertBefore);
// -orig.appendChild(table); - (replacing the above with this works just fine...)
} catch (ex) {
$log.warn(ex);
orig.appendChild(table);
}
}

I'm no expert, so I won't believe I have any idea what these do, however, I changed the orig.insertBefore() to the same line under the catch()... to orig.appendChild(table); and the issue went away... it no longer errors, and it updates the table just fine, with multiple tables on the same page...

Now, I have no idea what I may screw up, but it works... will do some further testing... thanks

@zafra6
Copy link
Contributor

zafra6 commented May 13, 2015

@SeoRoman see #91

@SeoRoman
Copy link
Author

ah very nice... well that makes sense then... guess it's been around for a while...

I think the if / else, should suffice the resolve then... well yay! I'm not the only one... and yay! it does fix the solution! so woot!

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

No branches or pull requests

2 participants