문제

I'm using jquery plugin table sorter trying to disable sorting on a column. I have tried:

data-sorter="false" //not working
class="{ sorter: false }" // not working
class="sorter-false" // not working

You can see here a plunkr: http://plnkr.co/edit/ZJINXSTBnsyd1sGpE1Ut?p=preview

도움이 되었습니까?

해결책

Adding the following as a parameter to the table order worked for me with your code:

$( '.dirf_tbl' ).tablesorter({

    headers: {
      // disable sorting of the first column (we start counting at zero)
      0: {
        // disable it by setting the property sorter to false
        sorter: false
      }
    }
    });

다른 팁

You can use headers option:

function tblSortOn(){
    $( '.dirf_tbl' ).addClass( 'tablesorter' );

    $(".dirf_tbl").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            }, 
            // assign the third column (we start counting zero) 
            2: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            } 
        } 
    }); 
}

In this case, your Last Name and Age will be disabled.

Updated Plunker

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top