How to get the Selected tables name or Id
How to get the Selected tables name or Id
support@kosmos.de
Posts: 16Questions: 7Answers: 0
I have a function where i pass the variable of a table. Because ihave multiple tables on my Site.
tabellePlan = $('#tabelle1).DataTable( {..})
tabelleKosten = $('#tabelle2').DataTable( {..})
tabellePlan.on( 'select', function () {
updateUeberblick(tabellePlan)
} );
function updateUeberblick(selectedTabelle){
var selectedId;
var selected = selectedTabelle.row( { selected: true } );
if ( selected.any() ) { selectedId = selected.data().id;
//get selectedTablles id <-----
switch(id) {
case x:
// code block
}
or is there a better way to solve this?
Answers
selectedTabbelle.table().node().id
returns undefined
Maybe its a typo in the post but you have two
b
in the above the variable you are passing into the function. This code snippet shows.table().node().id
does work:http://live.datatables.net/fuhuvuso/1/edit
In order to debug we will need to see the problem. please post a link to your page or a test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin