Can't get value of selected row with select plugin
Can't get value of selected row with select plugin
scotex
Posts: 3Questions: 1Answers: 0
Hi,
I'm creating and populating my table as follow
$('#tableArtikel').DataTable().destroy();
table = $('#tableArtikel').DataTable({
"processing": true,
"pageLength": 5,
"lengthChange": false,
"select": {
'style': 'single'
},
"ajax": {
"url": "@Url.Action("OmschrijvingFilter", "App")?id=" + $('#omschrijving').val(),
dataSrc: ''
},
"columns": [{
"data": "artikelnummmer"
}, {
"data": "omschrijving"
}],
'columnDefs': [
{
'width': 25,
'targets': 0
}],
'fixedColumns': true,
'order': [[0, 'asc']]
});
And I'm trying to get the value of first column from the selected row
I've tried following
table = $('#tableArtikel').DataTable();
var data = table.row({ selected: true }).data();
table = $('#tableArtikel').DataTable();
var data = table.row({ selected: true }).data()[0];
table = $('#tableArtikel').DataTable();
var data = table.row({ selected: true }).data.Nummer;
table = $('#tableArtikel').DataTable();
var data = table.row({ selected: true }).data()['Nummer'];
table = $('#tableArtikel').DataTable();
var data = table.row('.selected').data();
What am I doing wrong?
Thanks
This discussion has been closed.
Answers
Json format of my data is following
Its hard to say without knowing what happens.
Seems like this should get the data for all the columns. Does it?
These won't work because you don't have and object called 'Nummer
. Try using
artikelnummmer` instead.Kevin
Hi,
this worked
Thanks for your help !