aLengthMenu breaks when I add aaSorting

aLengthMenu breaks when I add aaSorting

personaltpersonalt Posts: 4Questions: 0Answers: 0
edited June 2011 in General
I am using the code below. it works fine, I have a nice table with alternating colored rows and a search box. user can sort fine after loading page. However I want to add an initial sort. I added a aaSorting entry but when I do that following break: sorting, search box, alternating row colors. Is aaSorting and aLengthMenu/iDisplaylength not compatibility?

[code]



$(document).ready(function() {
$('#example').dataTable({
"iDisplayLength": -1,
"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]

});
} );










RQ
XDM




<?php echo $row_rs_udm['RA']; ?>
<?php echo $row_rs_udm['fieldz']; ?>
<?php echo $row_rs_udm['fieldc']; ?>
<?php echo $row_rs_udm['description']; ?>


.......
[/code]

Replies

  • allanallan Posts: 63,189Questions: 1Answers: 10,412 Site admin
    edited June 2011
    It should work, but from your description you have a Javascript syntax error when you include aaSorting. Perhaps you can show us the code for how you do that. Also Firebug should show the error, what it is and where it is.

    Allan
  • personaltpersonalt Posts: 4Questions: 0Answers: 0
    edited June 2011
    Thanks for taking a look... full code below. I am playing in firebug but either don't see the error or dont know how to properly use.
    [code]



    Untitled Document



    <!-- Needed for jquery table support --->



    <!-- Not sure if this sheet is really used, I think this is only used when bjQuertyUI is true -->
    <!--
    -->









    $(document).ready(function() {
    $('#example').dataTable({

    "aaSorting": [[1,'asc'], [2,'desc']]
    "iDisplayLength": -1,
    "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]


    });
    } );








    HEAD
    HEAD2




    A
    B


    C
    D






    [/code]
  • allanallan Posts: 63,189Questions: 1Answers: 10,412 Site admin
    I'd be most surprised if that isn't given an error since there is a Javascript syntax error there. You currently have:

    [code]
    "aaSorting": [[1,'asc'], [2,'desc']]
    "iDisplayLength": -1,
    [/code]
    It's missing a comma after the aaSorting. So you want:

    [code]
    "aaSorting": [[1,'asc'], [2,'desc']],
    "iDisplayLength": -1,
    [/code]
    Allan
  • personaltpersonalt Posts: 4Questions: 0Answers: 0
    duh.. I didnt get a error but that worked fine when I made the change.. I will have to check my logging levels.
This discussion has been closed.