JQuery/Javascript Reordering rows

前端 未结 8 1361
时光说笑
时光说笑 2021-02-06 06:50

I have a aspx page that looks something like this:


  Some label
  Some complex control


        
相关标签:
8条回答
  • 2021-02-06 07:33

    Check the jQuery TableSorter Plugin, it's very powerful it detects the underlying datatypes of the columns, and you can sort your table columns programmatically:

    $("#yourTable").tablesorter( {sortList: [[0,0]]} );  
    // This will sort "yourTable" using 
    // the first column, ascending [columnIndex, 0=ASC or 1 = DESC]
    
    0 讨论(0)
  • 2021-02-06 07:33

    Keep in mind reording client-side leaves yourself open to issues in three ways.

    1. If the client computer is slow this reordering may be visible no matter what you do.
    2. The larger the table of data gets the slower this action will be and the more visible the reordering would be.
    3. Client could have JS disabled, which would break your reordering.

    Although it seems you want to do this client-side to save yourself some headaches now on the server-side programming, in the long run investing some time on this now to get it server-side will avoid these troubles.

    If you're having issues getting the server-side code to work right with your custom controls post it and we'll help you out.

    0 讨论(0)
提交回复
热议问题