Hi,
I have added datatable in my list and in each row, there is a button. I want to get a value from the clicked buttons row. please help me to find a solution for this
Hi,
Thank you for your reply and time spent to read my request. I did as per the example. But, i m geting null as result.
$('#servsallist').append('Doc No EC No Action ');
oTable = $('#servsallist').dataTable({
"bLengthChange": false,
"bPaginate": false ,
"aaSorting": [[ 0, "desc" ]]
});
$('input[type="button"]').click(function ()
{
alert("clicked ...");
/* Get the position of the current data from the node */
var sData = oTable.fnGetData( this );
alert("========= "+sData);
var aPos = oTable.fnGetPosition(this);
alert("aPos ..."+aPos);
/* Get the data array for this row */
var aData = oTable.fnGetData( aPos[0] );
/* Update the data array and return the value */
aData[ aPos[1] ] = 'clicked';
this.innerHTML = 'clicked';
});
I have posted the code and it is in the link
http://live.datatables.net/ofodif/3/edit#source
please check this. i am not getting the oTable.fnGetData( this ) value
Replies
Thank you for your reply and time spent to read my request. I did as per the example. But, i m geting null as result.
$('#servsallist').append('Doc No EC No Action ');
oTable = $('#servsallist').dataTable({
"bLengthChange": false,
"bPaginate": false ,
"aaSorting": [[ 0, "desc" ]]
});
$('input[type="button"]').click(function ()
{
alert("clicked ...");
/* Get the position of the current data from the node */
var sData = oTable.fnGetData( this );
alert("========= "+sData);
var aPos = oTable.fnGetPosition(this);
alert("aPos ..."+aPos);
/* Get the data array for this row */
var aData = oTable.fnGetData( aPos[0] );
/* Update the data array and return the value */
aData[ aPos[1] ] = 'clicked';
this.innerHTML = 'clicked';
});
});
This is the code I am using.
Regards,
Joby Joseph
Makes live much easier ;)
I have posted the code and it is in the link
http://live.datatables.net/ofodif/3/edit#source
please check this. i am not getting the oTable.fnGetData( this ) value
replaced $('table th') with $('table tr')
Is this what you were looking for?