Problem with sorting data

Problem with sorting data

yann0807yann0807 Posts: 2Questions: 0Answers: 0
edited April 2009 in General
Hello,
Hum I'm not english so sorry form my English.
So I've a problem with sorting data. I'm going to explain:
- Php file is loading by ajax
- This file is the result of a query which whow 4 columns (name contact, telephone, statut, e-mail, name enterprise)
- I put this in the end of the file



jQuery(document).ready(function() {

jQuery('#table_liste').dataTable( {

"iDisplayLength": 50,

"oLanguage": {
"sUrl": "http://localhost/prospect_client/libraries/fr.txt"
},
"sPaginationType": "full_numbers",

"aaSorting": [[ 1, "desc" ]],

"aoColumns": [
{ "sType": "html"},
{ "bSearchable": false, "bSortable": false },
{ "bSearchable": false, "bSortable": false },
{ "bSearchable": false, "bSortable": false },
{ "sType": "html" }
]
} );
} );

-Problem, no sorting!!!!! I've the same problem with anothers files (some files are working and another have problem).
Can you tell me what's the problem?
(If i click on the column, sort is ok but not at loading)
Thanks and sorry again for my english

Replies

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin
    Hi yann0807,

    Don't worry about your English - it's excellent!

    The problem here is that you have disabled sorting on column 1 (remember Javascript indexes start at 0, so column counting is 0, 1, 2, ...) - therefore DataTables is not sorting on that column!

    If you want to sort by column 1 (the second column) then you need to allow sorting on it (remove "bSortable": false).

    Hope this helps,
    Allan
  • yann0807yann0807 Posts: 2Questions: 0Answers: 0
    Ahhh yes!!!
    Thanks for all I'm too stupid!! Instead of starting at 0 , I started at 1 !!!
    Now, all is okay ;)
This discussion has been closed.