DataTable shows "No data available in table " before Ajax call made in document.ready()
DataTable shows "No data available in table " before Ajax call made in document.ready()
Vadivel
Posts: 10Questions: 1Answers: 0
Hello friends,
i m new to data table, i have a following issue in my data table
my data table shows "No data available in table " before Ajax call made in document.ready function. In my page i just loading droplist before document ready() and getting that value as ajax call request parameter.
i m new to data table, i have a following issue in my data table
my data table shows "No data available in table " before Ajax call made in document.ready function. In my page i just loading droplist before document ready() and getting that value as ajax call request parameter.
This discussion has been closed.
Replies
Allan
Following is my sample code to load data table in document ready:
oTable = $('#opportunityData').dataTable
( {
"sScrollY": 425,
"bFilter":true,
"sDom": 'rt<"bottom"lip><"clear">',
"bProcessing": true,
"bDestroy": true,
"sAjaxSource":appPath+"data/opportunity/search.html",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "resultsql", "value":resultsql} );
aoData.push( { "name": "jobdept", "value":jobdept} );
aoData.push( { "name": "edulevel", "value":edulevel} );
aoData.push( { "name": "explevel", "value":explevel} );
aoData.push( { "name": "Statedes", "value":statecode} );
aoData.push( { "name": "currentdistrict", "value":districtcode} );
aoData.push( { "name": "instname", "value":instName} );
},
"fnInitComplete": function() {
$('.dataTables_scroll').find('.dataTables_scrollBody').niceScroll({
cursorborder: 'none',
cursorcolor:"#CCCCCC",
autohidemode: false
});
// custom scroll bars
// $('.dataTables_scroll').find('.dataTables_scrollBody').mCustomScrollbar({
// scrollButtons:{
// enable:true
// }
//});
$('.dataTables_scrollHeadInner').css("width","100%");
$('.display').css("width","100%");
$("select").addClass("chzn-select-no-single");
// $("select").addClass("chzn-select");
$(".chzn-select-no-single").trigger("liszt:updated");
var config = {
'.chzn-select' : {},
'.chzn-select-deselect' : {allow_single_deselect:true},
'.chzn-select-no-single' : {disable_search_threshold:10},
'.chzn-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chzn-select-width' : {width:"95%"}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
} ,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"aoColumnDefs": [
{ "bSearchable": true, "bVisible": false, "aTargets": [8] }
],
// "sDom": 'T<"clear">lrtip',/*Task ID : SF00004*/
"oTableTools": {/*Task ID : SF00004*/
"sSwfPath": appPath+"resources/js/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "pdf",
"sButtonText": "Export as PDF",
//"sPdfMessage": "22/07/2013",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7]
},
{
"sExtends": "xls",
"sButtonText": "Export to Excel",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7]
},
]
},
"oLanguage":
{
"sSearch": "Search all columns:"
},
"bAutoWidth": false,
"aoColumns" : [
{ sWidth:"10%", "sClass":"gridwrap" },
{ sWidth: '10%', "sClass":"gridwrap" },
{ sWidth: '10%' , "sClass":"gridwrap"},
{ sWidth: '10%', "sClass":"gridwrap" },
{ sWidth: '10%', "sClass":"gridwrap" },
{ sWidth: '10%', "sClass":"gridwrap" },
{ sWidth: '10%' , "sClass":"gridwrap"},
{ sWidth: '10%', "sClass":"gridwrap" } ,
{ sWidth: '10%', "sClass":"gridwrap" },
{ sWidth: '10%',"sClass":"centeralign" }
]
} );
Allan