0

I want to set several settings to my DataTable:

$('#table').DataTable({
    "lengthMenu": [[6, 10, 15], [6, 10, 15]],
    "order": [[ 2, "desc" ]],
    "scrollX": true,
    "scrollY": 200
    }  );

But this:

    $('#table').DataTable({
        "lengthMenu": [[6, 10, 15], [6, 10, 15]]
});

or that:

$('#table').DataTable({
    "order": [[ 2, "desc" ]]

})

is working but It seems order is prioritized because it is set correctly. (Also If the lengthMenu is only set it works) but set like in the first code it just orders the data and no menu is shown. Someone got an idea?

EDIT: If I order in like this only ordering of column is done -> the opposite just does the lengthMenu:

$.extend( $.fn.dataTable.defaults, {                
    "order": [[ 2, "desc" ]]
    } );

$('#entity_type_table').DataTable({
    lengthMenu: [[6, 10, 15], [6, 10, 15]]
    }  );

1 Answer 1

2
i think your answer does not seems very specific  so i think u must see all setting option on the follwing link
 http://www.datatables.net/examples/index


i think u want to set diffrent constraints on differnt columns like
$('#example').DataTable({
            bFilter:true,
            bInfo:true,
            bPaginate: true,
            paging: true,
            searching: true,
            lengthMenu: [[100, 200, 500, -1], [100, 200, 500, "All"]],
            "aoColumnDefs": [
             { 'bSortable': false, 'aTargets': [ 1 ,11,13] }
             ],
            "scrollCollapse": true,
            "jQueryUI":       true,

            bDestroy: true

            });
Sign up to request clarification or add additional context in comments.

4 Comments

No I just want to set lengthMenu and a default Ordering "desc" that s it but instead of having Menu and Ordering only Ordering is executed.
for length menu --> lengthMenu: [[50,20,10],[50,20,10]]
It works as well with lengthMenu: [[6, 10, 15], [6, 10, 15]] as I want 6 as first length to fit into my dashboard... the issue is why it does not work together with "order": [[ 2, "desc" ]] ?
exactly this is the code I am using but the menu is gone and the whole table is shown in correct order...I think my table must be wrong so thanks for the help...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.