Two tables, one page...

Two tables, one page...

ztevieztevie Posts: 101Questions: 23Answers: 5
edited December 2016 in Free community support

Is it possible to have 2 tables in one page where:
* They use different Ajax sources and have different data types and columns.
* Table 2 is empty, or even better, hidden, until user makes a row choice in table 1. That choice triggers the Table 2 to call it's ajax src and load the data for it. So the ajax source for table 2 need to have an additional GET or POST (hidden field?) so the php know what data to load.
* Both tables will need their own separate add, edit and delete.

I have everything working fine in Table 1 and now want to load subdata in table 2 for viewing and editing.

This question has an accepted answers - jump to answer

Answers

  • ztevieztevie Posts: 101Questions: 23Answers: 5
    Answer ✓

    OK, found another thread that gave me a working solution. Here's how for later reference:


    //Initialize table holes, depending on blastchoice $('#tbl-admin-blasts').on( 'click', 'a.holes', function () { var blast_id = bTable.row($(this).closest('tr')).id().substring(4); var blast_name = bTable.cell( $(this).closest('tr'), 0 ).data(); $(".holetitle").html("för salva <b>" + blast_name + "</b>"); if(hTable !== null){ hTable.destroy(); } hTable = $('#tbl-admin-holes').DataTable( { language: { "url": "js/helpers/Swedish.json" }, dom: 'B<"clear"><"hToolbar">rtlip', responsive: true, processing: true, ajax: { url: "../_includes/process_adminholes.php?bid=" + blast_id, type: 'POST' }, order: [ 0, 'asc' ], columns: [ { data: "holes.hole_nr", responsivePriority: 1 }, { data: "holes.hole_depth", responsivePriority: 2 } ], //and so on.................................................
This discussion has been closed.