Sort by Last Name

Sort by Last Name

choggerchogger Posts: 15Questions: 4Answers: 0
edited July 2011 in General
Hi Guys, i'm trying to switch from tablesorter to Datatables because it has more features like filtering! But i am not able to sort a column with First and Last Name in it. It should be sorted by Last Name.

With the tablesorter plugin i adden an invisible span with numbers and sorted them (data is sorted by last name out of the mysql database). I tried this solution with datatables but failed. Any help would be appreciated.

Greetings Frank

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    2 options I can think of offhand:

    1) include a column for the last names, you can hide it with DataTables using bVisible in a column definition, but use it to sort by

    2) in your server side code, detect when they're sorting by name, then have your ORDER BY clause reflect this
  • choggerchogger Posts: 15Questions: 4Answers: 0
    I tried to sort it with numers and here is what happenend:
    http://www.chogger.de/try.png

    My code:
    [code]

    $(document).ready(function() {
    $('#table').dataTable( {
    "bPaginate": false,
    "bLengthChange": false,
    "bFilter": false,
    "bSort": true,
    "bInfo": false,
    "bAutoWidth": false,
    "aoColumns": [
    { "sType": "numeric" },
    null,
    null,
    null,
    null
    ] } );
    } );

    [/code]
This discussion has been closed.