Server side processing and sDom problem

Server side processing and sDom problem

radaoradao Posts: 2Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
Hello,

I've the following code for retrieving data from a svc service. It's working and the table is filled up, but if i add "sDom" to the code it returns an error ('length' is null or not an object) in jquery.dataTables.min.js , and the table isn't filled anymore.

Can anyone give me some light on this subject...

$("#dt_colVis_Reorder").dataTable({
"sDom": "R<'top'CTf>t<'dt-row dt-bottom-row'<'row-fluid'ip><'clear'>", --- If removed, code works fine !!!
"bProcessing": true,
"bJQueryUI": false,
"bAutoWidth": false,
"bServerSide": true,
"aaSorting": [[0, "asc"]],
"oLanguage": {
"sSearch": "Filtro _INPUT_"
},
"sAjaxSource": "http://localhost:1455/Companies.svc/Companies",
"sPaginationType": "bootstrap_full",
"fnDrawCallback": function () {
$('table#dt_colVis_Reorder td').bind('mouseenter', function () { $(this).parent().children().each(function () { $(this).addClass('datatablerowhighlight'); }); });
$('table#dt_colVis_Reorder td').bind('mouseleave', function () { $(this).parent().children().each(function () { $(this).removeClass('datatablerowhighlight'); }); });
},
"iDisplayLength": 20,
"oTableTools": {
"aButtons": [
{
"sExtends": "print",
"sButtonText": "Imprimir"
},
{
"sExtends": "xls",
"sButtonText": "Excel"
},
{
"sExtends": "pdf",
"sButtonText": "PDF"
}
],
"sSwfPath": "SBPOAdmin/js/lib/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
},
"aoColumns": [
{ "sTitle": "ID" },
{ "sTitle": "Company" },
{ "sTitle": "NIF" },
{ "sTitle": "Address" },
{ "sTitle": "Created Date" },
{ "sTitle": "Modified" },
{ "sTitle": "Deleted" },
{ "sTitle": "Status", "asSorting":[] }
],
"fnInitComplete": function (oSettings, json) {
$('.ColVis_Button').addClass('btn DTTT_button_print').html('Colunas');
$(this).closest('#dt_table_tools_wrapper').find('.DTTT.btn-group').addClass('table_tools_group').children('a.btn').each(function () {
$(this).addClass('btn-mini btn-inverse');
});
},
"fnServerData": function (sSource, aoData, fnCallBack) {
aoData.push({ "name": "websiteId", "value": 1 });
aoData.push({ "name": "categoryId", "value": 2 });
$.ajax({
type: "GET",
url: sSource,
data: aoData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg.d);
var json = $.parseJSON(msg.d);
fnCallBack(json);
}
})
}
});

Replies

  • radaoradao Posts: 2Questions: 0Answers: 0
    I found out that if i put "bProcessing" to false, "sDom" is parsed correctly and the results and layout are the expected.

    this is the function where it crashes :

    function _fnProcessingDisplay ( oSettings, bShow )
    {
    if ( oSettings.oFeatures.bProcessing )
    {
    var an = oSettings.aanFeatures.r;
    for ( var i=0, iLen=an.length ; i
  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin
    Your sDom is missing a closing bracket.

    Allan
  • nicolas69nicolas69 Posts: 11Questions: 0Answers: 0
    "R<'top'CTf>t<'dt-row dt-bottom-row'<'row-fluid'ip><'clear'>"
    there is an error here i think it's

    "R<'top'CTf>t<'dt-row dt-bottom-row'><'row-fluid'ip><'clear'>"
This discussion has been closed.