Exclude a column from being sorted using jQuery tablesorter

后端 未结 8 1873
有刺的猬
有刺的猬 2021-02-01 21:30

I am looking for a way to exclude a single column from being sorted using jQuery\'s tablesorter plugin. Specifically, I have a fairly large table and would like to keep a \"row

8条回答
  •  無奈伤痛
    2021-02-01 22:07

    Edit: I've made a sample of this technique at http://jsbin.com/igupu4/3. Click any column heading to sort...

    While I don't have an answer to your question about jquery, here's an alternate way to get the specific behaviour you described here, fixed row numbers after sorting. (Using CSS, specifically the content property, and counter related properties/functions.)

    
    
      test
      
      
      
      
    
    
    
      
    Col 1 Col 2

    foo

    quuz

    bar quux
    baz baz
    Rownums Col 1 Col 2 More Rownums

    foo

    bar

    quuz baz
    fred quux

    If your browser is sufficiently CSS2.1 compatible, you can use tr:before instead of td:first-child:before in sample 1. (Mozilla only supports this in trunk for now...)

    In sample 2, you can see how to position your row-number columns anywhere, not just in the first column.

提交回复
热议问题