Problem with different tables on same page with different data

Problem with different tables on same page with different data

alzamboalzambo Posts: 38Questions: 17Answers: 1
edited January 2016 in Free community support

Hi,
I have an issue with 2 tables on same pages, relying on the "same" configuration options.

var table = ({...});  // shared table options without "data" property

table.data = <?= $datiTabellaJs;?>; // define data section for table1 - 30 records
$('#tabellaDati1').DataTable(table); // init table 1
console.log(table.data); // correctly outputs 30 items

var table2 = table; // copy (?) options 
table2.data = <?= $datiTabella2Js;?>; // define data section for table1 - 30 records
$('#tabellaDati2').DataTable(table2); // init table 1
console.log(table2.data); // correctly outputs 10 items

Expected result:
table 1: 30 rows
table 2: 10 rows

Effectice result:
table 1: 30 rows
table 2: 30 rows

Where am I doing wrong?
Thank you,

Alex

Answers

  • alzamboalzambo Posts: 38Questions: 17Answers: 1

    ..up..

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    It's sort of hard to determine what's happening when so much of the code is missing. Since the number of displayed rows is based upon the length menu / length features, I would have to guess that you are not modifying, swapping out or setting that value correctly in your undisclosed code.

This discussion has been closed.