سؤال

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