aslagle/reactive-table

Table only updates when I update the fields from the first document

Opened this issue · 1 comments

I'm using aldeed:autoform to validade and update my collection.
I have Reactive Table displaying all the documents of my collection. When I click on a row, I have iron:router to set the template data context with the document:

this.route('formulario', {
        path: '/tabelas/:_id',
        data: function() {
            return Adverts.findOne(this.params._id);
        }

that sends to a template with autoform where I update the data in my collection.

<template name="formularioUpdate">
    {{> quickForm collection="Adverts" doc=this id="formularioUpdate" type="update"}}
</template>

The problem is that if I update the second row, the document gets updated in Mongo but nothing happens in ReactiveTable, but If I delete or edit the first one, it gets updated.
My table.js and html

Template.imoveis.helpers({
    table: function() {
        return Adverts.find().fetch();
     },
});

Template.imoveis.events({
    'click #dwnldFiles': function() {
       Meteor.call('downloadUpdatedXML', listaImoveis ,function(error, xml){
        console.log(xml)
        // saveAs(new Blob([xml], { type: 'application/octet-stream' }), 'FicheiroConvertido.xml')
       });
    },
    'click .reactive-table tbody tr': function(event) {
        Router.go('formulario', {_id: this._id});
    }
});
<div>
        {{> reactiveTable collection=table}}
</div>

Hi @xMaarf, I think your problem might be that you're using Adverts.find().fetch() in your table function. This returns an array rather than the Meteor collection object so the table won't be able to get updates. I'm not sure why the first row works, but try using just Adverts instead.