Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in reactivity of table #1

Closed
mherb63 opened this issue Mar 3, 2017 · 7 comments
Closed

Possible bug in reactivity of table #1

mherb63 opened this issue Mar 3, 2017 · 7 comments

Comments

@mherb63
Copy link

mherb63 commented Mar 3, 2017

The Table is not staying in sync with the Meteor collection. For example, if I have 4 documents in my table in Mongo and I manually remove 1 of those documents, the table will update but will duplicate all existing entries.

it appears this function is not producing the differences between the datatables content and the Meteor.collection content

       reactiveDataTable.difference = function(array){
       var rest = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));

       var containsEquals = function(obj, target) {
        if (obj == null) return false;
        return _.any(obj, function(value) {
          return _.isEqual(value, target);
        });
      };

      return _.filter(array, function(value){ return ! containsEquals(rest, value); });
    };

   
@cdolek
Copy link
Owner

cdolek commented Mar 3, 2017

@mherb63 are you using the rowId? This is necessary for the function to figure out differences coming from the collection.

@mherb63
Copy link
Author

mherb63 commented Mar 4, 2017

yes, I saw that and I'm not writing anything to row id. I checked my table and it has the collection object id as the row id for the table:

image

image

Here's what it looks like after I remove a row (via Meteor Mongo shell)
image

image

@cdolek
Copy link
Owner

cdolek commented Mar 4, 2017

@mherb63 I'm a bit busy these days, please use ephemer:reactive-datatables until I fix this.

@mherb63
Copy link
Author

mherb63 commented Mar 4, 2017

Wow, really? I came here because of problems with his. In fact, on your README.md you specifically mention that you built this repo because he was non responsive.

You should close the repo if you don't want to support it.

@cdolek
Copy link
Owner

cdolek commented Mar 4, 2017

@mherb63 please try the fix I have just committed

@mherb63
Copy link
Author

mherb63 commented Mar 4, 2017

Thank You!

Do I just uninstall the plugin and reinstall it?

@mherb63
Copy link
Author

mherb63 commented Mar 4, 2017

I just tried and it appears to be working correctly now. I will keep testing, but close this out for now.

Thank you very much for fixing this. Your datatables plugin was the only one I could get working with the features that I needed.

@mherb63 mherb63 closed this as completed Mar 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants