Triggering two refreshes with one click

Triggering two refreshes with one click

martinconnollybartmartinconnollybart Posts: 21Questions: 8Answers: 0

Hi, I have a table which links to two other tables. I want a select on the first table to trigger loads on the other two tables. If I put both reloads (and supply the linking field value for the associated editor) in the on select event, only the first one happens.
This is my code:

    fundTable.on('select', function(){
                appTable.ajax.reload();
                appEditor.field('TApplications.funderid')
                    .def(fundTable.row({selected:true}).data().id);
                contactTable.ajax.reload();
                contactEditor.field('TFunderContacts.funderid')
                  .def(fundTable.row({selected:true}).data().id); 
            });

It doesn't matter which way round I put the two table reloads - only the first happens. Is there another way I should be doing this? Thanks.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Both appTable and contactTable should be doing an Ajax reload there.

    Can you link to a page showing the issue so I can investigate what is going wrong please?

    Allan

  • martinconnollybartmartinconnollybart Posts: 21Questions: 8Answers: 0

    Hi @allan I can't really - this is currently just on a laptop where I'm developing the application, and I access the laptop from home using Chrome Remote Desktop. If I put a breakpoint in the code there, it goes through the first table reload and then seems to completely ignore the second one. Would it be feasible as an alternative to do the second reload from an event triggered by the first reload?

  • martinconnollybartmartinconnollybart Posts: 21Questions: 8Answers: 0

    OK, it's the passing of the parameter to the editor instance that seems to be the problem. I changed the code as follows:

     fundTable.on('select', function(){
                appTable.ajax.reload();
                contactTable.ajax.reload();         
            });
    
    appTable.on('select', function(){
                appEditor.field('TApplications.funderid')
                .def(appTable.row({selected:true}).data().funderid);
            });
    
     contactTable.on('select', function(){
                contactEditor.field('TFunderContacts.funderid')
                .def(contactTable.row({selected:true}).data().funderid); 
            });
    

    And that all works perfectly now.

Sign In or Register to comment.