Custom Sorting Column of Capacities in jQuery Datatables

Custom Sorting Column of Capacities in jQuery Datatables

LizaLiza Posts: 6Questions: 3Answers: 0
edited March 2015 in Free community support

Hello
I have a datatable with capacities column like this :

<table id="datatable" class="table">
<thead> <tr> <th>capa</th> </tr> </thead>
<tbody>
    <tr>
      
        <td>2 Go</td>
    </tr>
    <tr>
       
        <td>1 To</td>
    </tr>
    <tr>
       
        <td>320 Go</td>
    </tr>
    <tr>
      
        <td>2 To</td>
    </tr>
    <tr>
        
        <td>500 Go</td>
    </tr>
</tbody>
</table>

<script>
$(document).ready(function() {
    $('#datatable').dataTable({
    'aaSorting': [],
    'iDisplayLength': 50,
    'aLengthMenu': [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, 'Tous']]
    });
}); 
</script>

and I am trying to sort it to get this result :

2 Go
320 Go
500 Go
1 To
2 To

But can't figure out how to do it from reading the sorting plugins docs.

Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    The file size plug-in is probably the best starting point. If you struggle with that, post up your code and I'll take a look.

    Allan

  • LizaLiza Posts: 6Questions: 3Answers: 0

    Thanks very much. it works with file size plug-in

This discussion has been closed.