Bug with sAjaxSource, sDom and fnInitComplete
Bug with sAjaxSource, sDom and fnInitComplete
Can't seem to be able to modify sDom when i use sAjaxSource ?
[code]
$(document).ready(function () {
$("#listUser").dataTable({
"oLanguage": { "sUrl": "Public/DataTables-1.7.5/media/language/fr-FR.txt" },
"sAjaxSource": '/administration/users/search',
//"bServerSide":true,
"bAutoWidth": false,
"bProcessing": true,
"bPaginate": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"fnInitComplete": function () {
alert("init");
//$("div.tabletbAddBtn").html('Nouveau');
},
"sDom": '<"H"<"tabletbAddBtn">lf>t<"F"ip>',
"aoColumns": [
{ "sName": "Id", "bVisible": false, "bSearchable": false, "bSortable": false },
{ "sName": "Username", "sWidth": "200px", "fnRender": function (oObj) { return '' + oObj.aData[1] + ''; } },
{ "sName": "Firstname", "sWidth": "250px" },
{ "sName": "Lastname", "sWidth": "250px" },
{ "sName": "Email", "sWidth": "300px" }
],
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "Role", "value": $('#Role').val() });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json)
});
}
});
});
[/code]
This code doesn't work. The table doesn't get rendered correctly and the server is not called for retrieving the data.
if i comment sDom then it work ?
Any Idea.
I'm using the same functionalities witj other tables that are not using sAjaxSource and it work just fine so i guess its a problem related to sAjaxSource being called ?
Thanks
[code]
$(document).ready(function () {
$("#listUser").dataTable({
"oLanguage": { "sUrl": "Public/DataTables-1.7.5/media/language/fr-FR.txt" },
"sAjaxSource": '/administration/users/search',
//"bServerSide":true,
"bAutoWidth": false,
"bProcessing": true,
"bPaginate": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"fnInitComplete": function () {
alert("init");
//$("div.tabletbAddBtn").html('Nouveau');
},
"sDom": '<"H"<"tabletbAddBtn">lf>t<"F"ip>',
"aoColumns": [
{ "sName": "Id", "bVisible": false, "bSearchable": false, "bSortable": false },
{ "sName": "Username", "sWidth": "200px", "fnRender": function (oObj) { return '' + oObj.aData[1] + ''; } },
{ "sName": "Firstname", "sWidth": "250px" },
{ "sName": "Lastname", "sWidth": "250px" },
{ "sName": "Email", "sWidth": "300px" }
],
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "Role", "value": $('#Role').val() });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json)
});
}
});
});
[/code]
This code doesn't work. The table doesn't get rendered correctly and the server is not called for retrieving the data.
if i comment sDom then it work ?
Any Idea.
I'm using the same functionalities witj other tables that are not using sAjaxSource and it work just fine so i guess its a problem related to sAjaxSource being called ?
Thanks
This discussion has been closed.