Jquery drill down data table - dynamic data is not displaying without alert()

Jquery drill down data table - dynamic data is not displaying without alert()

lokeshc915lokeshc915 Posts: 2Questions: 0Answers: 0
edited November 2013 in General
allan,

I am able to fetch the data from server side and creating new table with dynamic data.
but here i am facing one issue like, when i am using the alert(), it is displaying correctly.
Without alert() it is not displaying the dynamic data.

Please help me to resolve this issue.

It should display the data without any alerts.

code:

$(document).ready(function () {
var oTable = $("#companies").dataTable({
"bServerSide": true,
"sAjaxSource": "/JQueryDataTables/CompanyGsonMatrix",
"bProcessing": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"aoColumns": [
{
"mDataProp": null,
"sClass": "control center",
"sDefaultContent": ''
},
{ "mDataProp": "name" },
{ "mDataProp": "address" },
{ "mDataProp": "town" }
]
});


var clickedRowId, nTr;
var anOpen = [];
$('#companies td.control').live( 'click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );
$(anOpen).each( function () {
if ( this !== nTr ) {
$('td.control', this).click();
}
} );

if ( i === -1 ) {
$('img', this).attr( 'src', "details_close.png" );
var nDetailsRow = oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
$('div.innerDetails', nDetailsRow).slideDown();
anOpen.push( nTr );
}
else {
$('img', this).attr( 'src', "details_open.png" );
anOpen.shift();
oTable.fnClose( nTr );
anOpen.splice( i, 1 );
}
} );

function fnFormatDetails ( oTable, nTr ) {
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+
'Company nameAddressTown';

$.getJSON( 'CompanyEmployee', {companyId:'1'}, function( json ) {

for (var i = 0; i < json.length; i++) {
sOut = sOut.concat(''+json[i].Name+''+json[i].Position+''+json[i].Phone+'');
}
});

sOut = sOut.concat('');
alert();
return sOut;
}

});



Thanks in advance.

Replies

This discussion has been closed.