I am new to Datatables/js etc and have no training in this. It's a hobby. So far, I have 2 HTML pages that calls 1 main.js file from which I can call the functions to produce 2 tables from 2 API's as offered. What I want to do, is combine parts of one api with another to produce the table layout I want. I have found out that if you load onr table then switch HTML pages, the main.js is read from the start so you lose the content of global variables. I have tried to get round this by using this code provided by Allan on another thread
var data = [];
table.rows().every( function () {
data.push( table.cells( this, [ 0, 1, 2 ] ).data().toArray() );
} );
but that does not seem to store the array in a format that can be accessed ( no [] or {} bits, probably the way I am using it)
I have also tried HTML localStore, sessionStore, but again I can't access the data although I can see it in console.log.
The best I have managed so far is to get an entire array into one column rather than just the one item.
I am thinking maybe I should split up the main.js file for use by each HTML page? Later, I may add more pages so before going down this route I thought I would ask what 'best practice' is from a datatables perspective to combine and access multiple api's on one HTML page and if there is an example that can be pointed to.
Thank you.