Sorting with a hyperlink

Sorting with a hyperlink

looafunklooafunk Posts: 2Questions: 0Answers: 0
edited February 2011 in General
Hi guys,
I'm trying to use datatables with asp.net. I have a link button places inside each "". When it comes to sorting the data it goes horribly wrong and does, 1, 10,11,12,13,14,15 etc..

Is there a way i can configure the datatable to sort by the text stored in the button link?

here's my code,thanks!!




<%# Eval("Number") %>

Internet
Explorer 4.0
Win 95+
4
X

Replies

  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    show your dataTable initialization code...and full html..while seeing this code i can syat that table is not proper...so that dataTable can work on it..

    regards,
    vivek
  • looafunklooafunk Posts: 2Questions: 0Answers: 0
    I'm just using the basic init

    $(document).ready(function() {
    $('#example').dataTable();
    });
  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    you can use this code....on click of button

    [code]$(document).ready(function() {
    var oTable = $('#example').dataTable();
    $('#buttonId').click(function(){
    oTable.fnSort(columnNo);
    });
    }); [/code]
  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin
    Which version of DataTables are you using? v1.7+ will automatically strip HTML tags from the sort, so I'm going to guess that you are using 1.6 or before - in which case you can either upgrade :-), or make use of sType and set it to 'html' for the column you want: http://datatables.net/usage/columns#sType

    Allan
This discussion has been closed.