event for more all dataTables on page

event for more all dataTables on page

montoyammontoyam Posts: 568Questions: 136Answers: 5

I found the following documentation on how to refer to multiple datatables: https://datatables.net/manual/api#Plural-/-Singular

I have a page that has three datatables. In the $(document).ready function I have the data tables defined and functioning properly. At the end, still within the document.ready function, I placed the following code to reload all the grids when a new record is added to any of them:

        var tables = $('.dataTable').DataTable();
        tables.on('postCreate', function () {
            alert("reloading");
            FundOrgDetailTable.ajax.reload();
            UnAssignedFTETable.ajax.reload();
        });

However, the function seems to never be called. What am I doing wrong?

This question has an accepted answers - jump to answer

Answers

  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    Ah, I just realized after I posted that I am adding the event to a datatable, not the editors. What is the correct syntax for line one to reference all the editors?

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    Answer ✓

    For the Editor, you would need to access them all individually, there isn't a plural for those. You could make put the objects into an array then cycle through them, perhaps.

    Colin

This discussion has been closed.