fnGetData not working

fnGetData not working

robascrobasc Posts: 1Questions: 0Answers: 0
edited March 2012 in DataTables 1.9
Hello all,

I have the following code below. For some reason I cannot get the data from the table when the click event if fired. Any help would be very much appreciated. Also I am looking for a better way to refresh my table without using the tbl variable to reload my table.

Thanks

Javascript:
[code]
var StatSum = {

tbl: ''+
'Order #'+
'TreatmentCust NameCust Order #S Person'+
'Order DateMat Rcvd DateDate Due To ShipStatus'+
'Date RdyCarrierTo TordShippedNotes'+
'',

getSite: function(){

$.ajax({

type: "POST",
url: "?do=getsite",
dataType: "json",
async: false,
success: function(jsonObj) {

var listItems= "";

listItems+= ""; // fill first entry with a blank value

for (var i in jsonObj){

listItems+= '' + jsonObj[i].siteId + '';
}
$("#site").html(listItems);
// $("#site").val(site);
}
});
},

getStatusSum: function(siteId){

$.ajax({
type: "POST",
url: "?do=getstatussum&siteId="+siteId,
dataType: "json",
async: false,
success: function(jsonObj) {

tableItems = "";
for(var i in jsonObj){
tableItems += ''+
'' + jsonObj[i].ordNbr + '' + jsonObj[i].tr + ''+
'' + jsonObj[i].custName + '' + jsonObj[i].custNbr + '' +
'' + jsonObj[i].slId + '' + jsonObj[i].ordDate + '' +
'' + jsonObj[i].maDt + '' + jsonObj[i].dtDue + '' +
'' + jsonObj[i].stat + '' + jsonObj[i].dtRd + '' +
'' + jsonObj[i].car + '' + jsonObj[i].toT + '' +
'' + jsonObj[i].ship + '' + jsonObj[i].notes + '' +
'';
}
$('#data').html(tableItems);
}

});
}
};

$(document).ready(function(){
/** set document title **/
document.title = "Status Sheet";

var oTable = $('#grid').dataTable();

StatSum.getSite();

/**
* event called when a change occurs to the site select
*/
$('.siteId').change(function(){
var siteId = $("#site").val();
if(siteId != "empty"){
$(".message").hide();
$(".message").css('display','none');
$('#wrapper').replaceWith(StatSum.tbl);
StatSum.getStatusSum(siteId);
$('#wrapper').show();
oTable = $('#grid').dataTable({
"sPaginationType": "full_numbers",
"bScrollAutoCss": true,
"sScrollY": "500px"
});
}
else{
$("#wrapper").empty();
$("#message").show();
}
}); // end


oTable.$('td').click(function () {

var sData = oTable.fnGetData( this );
alert( 'The cell clicked on had the value of '+sData );
} );

});
[/code]

Html

[code]










Status Sheet
Please select a site to begin:
Select Site:





Order #
Treatment
Cust Name
Cust Order #
S Person
Order Date
Mat Rcvd Date
Date Due To Ship
Status
Date Rdy
Carrier
To Tord
Shipped
Notes






[/code]
This discussion has been closed.