Use fnGetSelected() to return a value in the selected row
Use fnGetSelected() to return a value in the selected row
Hello, a bit of a newb with DataTables but I hope this is an easy answer. I want to update a tag to display a value of a specific cell in the row I select.
[code]
$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
//
var anSelected = fnGetSelected( oTable );
//
var anSelectedData = anSelected.**GET CELL DATA**
//
showPanel(anSelectedData);
});
function showPanel(cellID) {
document.getElementById("testing").innerHTML = cellID;
}
[/code]
[code]
$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
//
var anSelected = fnGetSelected( oTable );
//
var anSelectedData = anSelected.**GET CELL DATA**
//
showPanel(anSelectedData);
});
function showPanel(cellID) {
document.getElementById("testing").innerHTML = cellID;
}
[/code]
This discussion has been closed.
Replies
[code]
var anSelectedData = oTable.fnGetData( anSelected[0] );
[/code]
Allan