Need Help Dynamically Updating the sScrollY
Need Help Dynamically Updating the sScrollY
So here is what I'm trying to do.. I have a web service pulling in data.. I loop through the data to get counts and stuff.. I'm using the intCounterHeight to count as it loops through the data.. If intCounterHeight is greater than 300 then I want the sScroll = 300 else just make it the intCounterHeight I can get the number but it will not set the sScrollY ? Not sure why... Can you let me know how to get the intCounterHeight to set the sScrollY please.
I currently have 13 reports on a single page each using a instance of dataTables it is working great just need to clean it up and not have the footer set at 300 on each it does not look good to have no data and the footer setting at 300px away form the data..
Thanks
Troy
[code]
function loadLeadVolumeReportData(strAgent, strSkillGroup, strCampaign, strStartDate, strEndDate) {
var intCounterHeight = 25;
$("#LeadVolumeReportingTable").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"asStripClasses": null,
"bProcessing": true,
"bServerSide": true,
"bDestroy": true,
"sAjaxSource": "Services/xxxx/xxxxxx",
"bDeferRender": true,
"sDom": "rtS",
"fnServerParams": function (aoData) {
aoData.push({ "name": "strAgent", "value": strAgent });
aoData.push({ "name": "strSkillGroup", "value": strSkillGroup });
aoData.push({ "name": "strCampaign", "value": strCampaign });
aoData.push({ "name": "strStartDate", "value": strStartDate });
aoData.push({ "name": "strEndDate", "value": strEndDate });
},
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "GET",
"url": sSource,
"data": aoData,
"success":
function (msg) {
var json = jQuery.parseJSON(msg.d);
fnCallback(json);
$("#LeadVolumeReportingTable").show();
}
});
},
"fnFooterCallback": function (nRow, aoData) {
var nCells = nRow.getElementsByTagName('th');
var iVolumeTotal = 0;
for (var i = 0 ; i < aoData.length ; i++) {
iVolumeTotal += parseInt(Number(parseInt(aoData[i][1].replace(/[^0-9\.]+/g, ""))));
intCounterHeight += 50;
}
if (intCounterHeight >= 300) {
intCounterHeight = 300;
}
nCells[1].innerHTML = FormatNumber(iVolumeTotal);
$('#LeadVolumeReport').fadeTo(500, 1.0);
onStartShowHideLeadVolumeReport(g_ShowHide);
},
"sScrollY": intCounterHeight
});
}
[/code]
I currently have 13 reports on a single page each using a instance of dataTables it is working great just need to clean it up and not have the footer set at 300 on each it does not look good to have no data and the footer setting at 300px away form the data..
Thanks
Troy
[code]
function loadLeadVolumeReportData(strAgent, strSkillGroup, strCampaign, strStartDate, strEndDate) {
var intCounterHeight = 25;
$("#LeadVolumeReportingTable").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"asStripClasses": null,
"bProcessing": true,
"bServerSide": true,
"bDestroy": true,
"sAjaxSource": "Services/xxxx/xxxxxx",
"bDeferRender": true,
"sDom": "rtS",
"fnServerParams": function (aoData) {
aoData.push({ "name": "strAgent", "value": strAgent });
aoData.push({ "name": "strSkillGroup", "value": strSkillGroup });
aoData.push({ "name": "strCampaign", "value": strCampaign });
aoData.push({ "name": "strStartDate", "value": strStartDate });
aoData.push({ "name": "strEndDate", "value": strEndDate });
},
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "GET",
"url": sSource,
"data": aoData,
"success":
function (msg) {
var json = jQuery.parseJSON(msg.d);
fnCallback(json);
$("#LeadVolumeReportingTable").show();
}
});
},
"fnFooterCallback": function (nRow, aoData) {
var nCells = nRow.getElementsByTagName('th');
var iVolumeTotal = 0;
for (var i = 0 ; i < aoData.length ; i++) {
iVolumeTotal += parseInt(Number(parseInt(aoData[i][1].replace(/[^0-9\.]+/g, ""))));
intCounterHeight += 50;
}
if (intCounterHeight >= 300) {
intCounterHeight = 300;
}
nCells[1].innerHTML = FormatNumber(iVolumeTotal);
$('#LeadVolumeReport').fadeTo(500, 1.0);
onStartShowHideLeadVolumeReport(g_ShowHide);
},
"sScrollY": intCounterHeight
});
}
[/code]
This discussion has been closed.
Replies