Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82142

fnGetData returns undefined for rows using mdata

$
0
0
Hi,

In my DataTables I am trying to pass a unique ID with fnGetData that is a hidden column when my Editor form is submitted. The ID is not being passed (it is coming up as undefined if I console.log the event) apparently due to the fact that the hidden ID column is listed in my aoColumnDefs with 'mData'. If I remove that column from 'mData' then it returns the ID as expected. However, I also get this error:

DataTables warning (table id = 'gatewayTable'): Requested unknown parameter '5' from the data source for row 3

and the submit fails.

Any idea why these two things are clashing? Here is the related code.

oTable = $('##gatewayTable').dataTable({
	"sDom": "<'row-fluid'<'span5'T><'span3'l><'span4'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
	"sPaginationType": "bootstrap",
	"oLanguage": {
		"sLengthMenu": "_MENU_ records per page",
		"sInfoFiltered": "(_MAX_ total)"
	},
	"aoColumnDefs": [
		{ "aDataSort": [ 2, 1, 0 ], "aTargets": [ 2 ] },
		{ "mData": "mac", "aTargets": [ 0 ] },
		{ "mData": "name", "aTargets": [ 1 ] },
		{ "mData": "location_id", "aTargets": [ 2 ] },
		{ "mData": "type", "aTargets": [ 3 ] },
		{ "mData": "status_cde", "aTargets": [ 4 ] },
		{ "mData": "gateway_id", "aTargets": [ 5 ] }
	],
	"oTableTools": {
		"sRowSelect": "single",
		"sSelectedClass": "row_selected",
		"fnRowSelected": function ( node ) {
			gateway_id = oTable.fnGetData(node[0])[5];
			console.log(oTable.fnGetData(node[0])[5]);
		},
		"aButtons": [
			{ "sExtends": "editor_create", "editor": editor },
			{ "sExtends": "editor_edit",   "editor": editor },
			{ "sExtends": "editor_remove", "editor": editor }
		]
	}
});

Thanks,
Carl

Viewing all articles
Browse latest Browse all 82142

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>