how to get tag inside cell in datatable
how to get tag inside cell in datatable
Hi,
I generate link in cell through json format from server side, then i want to put click event on link (modify or delete), but i can't get link using $('#myTable tbody tr td a'). code is below:
$(function() {
var oTable = $('#myTable').dataTable({
sScrollY: 200,
"bScrollCollapse": true,
bProcessing: true,
bPaginate: false,
bFilter: false,
bInfo: false,
bSortable: true,
bRetrieve: true,
sAjaxSource: "data.jsp",
aoColumns:[null,
null,
null,
null,
null,
null,
null,
{"bVisible": false}
],
"fnInitComplete": function () {
$('#myTable tbody tr td').on("click", function () {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
alert(aData[6]);
} );
}
});
json:
{
"sEcho": 1,
"aaData": [
[
"",
"Gecko",
"Firefox 1.0",
"Win 98+ / OSX.2+",
"1.7",
"A",
"Modify Delete",
"1"
]
}
I also couldn't get checkbox tag either.
any ideas will be appreciated.
I generate link in cell through json format from server side, then i want to put click event on link (modify or delete), but i can't get link using $('#myTable tbody tr td a'). code is below:
$(function() {
var oTable = $('#myTable').dataTable({
sScrollY: 200,
"bScrollCollapse": true,
bProcessing: true,
bPaginate: false,
bFilter: false,
bInfo: false,
bSortable: true,
bRetrieve: true,
sAjaxSource: "data.jsp",
aoColumns:[null,
null,
null,
null,
null,
null,
null,
{"bVisible": false}
],
"fnInitComplete": function () {
$('#myTable tbody tr td').on("click", function () {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
alert(aData[6]);
} );
}
});
json:
{
"sEcho": 1,
"aaData": [
[
"",
"Gecko",
"Firefox 1.0",
"Win 98+ / OSX.2+",
"1.7",
"A",
"Modify Delete",
"1"
]
}
I also couldn't get checkbox tag either.
any ideas will be appreciated.
This discussion has been closed.
Replies
Allan
> bRetrieve: true,
Why is that there?
thanks for your response. i got rid of 'bRetrieve: true,', still doesn't work.
i put those code in jsp page, running on Jboss 7, i don't know how to provide test case, can you give me some clue?
i made mistake, code should be:
"fnInitComplete": function () {
$('#myTable tbody tr td a').on("click", function () {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
alert(aData[6]);
} );
}
$('#myTable tbody tr td') worked, but when i want to narrow it down to tag, it failed, checkbox tab as well.
Yes - give me the Url for the page you are working on. Without a test case I can't help.
this is just running on my laptop, there is no public IP, i will look for hosting environment.