Server Side Processing

Server Side Processing

mohaideenmohaideen Posts: 10Questions: 3Answers: 0
edited April 2014 in General
[quote]
I have passing argument to the server page. and get json Details from server. Here data didn't come to dataTable. In server i get the passed argument like this
[/quote]

[code]
$imei = trim($_GET['imei']);
[/code]

[code]
function DataTable(imei_app) {
var DataTableApp = $('#DataTableApp').dataTable({
"sAjaxSource": "php/getAppDetails.php",
"bServerSide": true,
"bRetrieve":true,
"bDestroy":true,
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name" : "imei", "value":imei_app } );
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json);
console.log(json);
});
},
"aoColumns": [{
"mData": "appName",
}, {
"mData": "appId",
}, {
"mData": "versionInstalled"
}, {
"mData": "appSize",
}, {
"mData":"dataSize",
},{
"mData": "appType",
},{
"mData":"installedLocation",
},{
"mData": "appType",
}],
});
}
[/code]

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Use fnServerParams and have a look at the example in the documentation for the format of the object that needs to be used.

    Allan
  • mohaideenmohaideen Posts: 10Questions: 3Answers: 0
    [quote]
    I am using this. but there is no response from server. and Table shows data is empty
    [/quote]
    [code]
    var DataTableApp = $('#DataTableApp').dataTable({
    "sAjaxSource": "php/getAppDetails.php",
    "bRetrieve":true,
    "bDestroy":true,
    "fnServerParams": function ( aoData ) {
    var imei_apps = document.getElementById('imei').value;
    aoData.push( { "name": "imei", "value": imei_apps } );
    },
    "aoColumns": [{
    "mData": "appName",
    }, {
    "mData": "appId",
    }, {
    "mData": "versionInstalled"
    }, {
    "mData": "appSize",
    }, {
    "mData":"dataSize",
    },{
    "mData": "appType",
    },{
    "mData":"installedLocation",
    },{
    "mData": "appType",
    }],
    });
    [/code]
This discussion has been closed.