"fnInitComplete": function()

"fnInitComplete": function()

lolodevlolodev Posts: 17Questions: 0Answers: 0
edited June 2012 in General
hi;

i try to use class "fnInitComplete" to add select and make a sort function
[code]

$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"bDestroy":true,

"oLanguage": {
"sLengthMenu": "Afficher_MENU_ records per page",
"sZeroRecords": "Nothing found - sorry",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
"sInfoEmpty": "Showing 0 to 0 of 0 records",
"sInfoFiltered": "(filtered from _MAX_ total records)",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier"
}
},
"sAjaxSource": "scripts/server_processing.php",

"fnInitComplete": function(){
$('#example').append('Trier par :DateDistanceTitre');
$("#sortevent").change(function () {
searchincoming = false;
if ($("#sortevent").val() == 'evtstartdate'){
$("#example").fnSort( [ [2,'asc']] );
}
else if($("#sortevent").val() == 'evttitle') {
$("#example").fnSort( [ [1,'asc']] );
}
else{
$("#example").fnSort( [ [4,'asc']] );
}
})
}


} );
} );

[/code]


Sort doesn't run, peharps an idea ?? thnaks

Replies

  • lolodevlolodev Posts: 17Questions: 0Answers: 0
    i've found:
    [code]

    $(document).ready(function() {
    oTable=$('#dataTable_gmaps').dataTable( {
    "bProcessing": true,

    "bServerSide": true,
    "sDom": '<"top"pi>rt<"bottom"p>',
    "sPaginationType": "full_numbers",
    "bDestroy":true,
    "oLanguage": {
    "sLengthMenu": "Afficher_MENU_ records per page",
    "sZeroRecords": "Nothing found - sorry",
    "sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
    "sInfoEmpty": "Showing 0 to 0 of 0 records",
    "sInfoFiltered": "(filtered from _MAX_ total records)",
    "oPaginate": {
    "sFirst": "Premier",
    "sPrevious": "Précédent",
    "sNext": "Suivant",
    "sLast": "Dernier"
    }
    },
    "sAjaxSource": "scripts/server_processing.php",

    "fnInitComplete": function(){
    $('#dataTable_gmaps').append('Trier par :DateDistanceTitre');
    $("#sortevent").change(function () {
    searchincoming = false;
    if ($("#sortevent").val() == 'evtstartdate'){
    oTable.fnSort( [ [2,'asc']] );
    }
    else if($("#sortevent").val() == 'evttitle') {
    oTable.fnSort( [ [1,'asc']] );
    }
    else{
    oTable.fnSort( [ [4,'asc']] );
    }
    })
    }


    } );
    } );

    [/code]
This discussion has been closed.