Select cell only working on first row or first page
Select cell only working on first row or first page
I have a Datatable set up and ideally would like it so that when the user clicks a cell in column 4, they will be presented with more information.
I have tried two methods:
[code]
$('td:eq(4)', '#the_table > tbody > tr').on('click', function(){
var data = oTable.fnGetData(this);
$("#modalHeader").text("Shipping Information");
$("#modalBody").text(data);
$("#modal-window").modal('show');
});
[/code]
This will work for values on the first page, but when I move onto the next page of records, it stops working.
[code]
$('#the_table tbody tr td:eq(4)').live('click', function(){
var data = oTable.fnGetData(this);
$("#modalHeader").text("Shipping Information");
$("#modalBody").text(data);
$("#modal-window").modal('show');
});
[/code]
This will work only on the first record, but works if I move onto the next page.
Any help/advice would be much appreciated
I have tried two methods:
[code]
$('td:eq(4)', '#the_table > tbody > tr').on('click', function(){
var data = oTable.fnGetData(this);
$("#modalHeader").text("Shipping Information");
$("#modalBody").text(data);
$("#modal-window").modal('show');
});
[/code]
This will work for values on the first page, but when I move onto the next page of records, it stops working.
[code]
$('#the_table tbody tr td:eq(4)').live('click', function(){
var data = oTable.fnGetData(this);
$("#modalHeader").text("Shipping Information");
$("#modalBody").text(data);
$("#modal-window").modal('show');
});
[/code]
This will work only on the first record, but works if I move onto the next page.
Any help/advice would be much appreciated
This discussion has been closed.
Replies