简体   繁体   中英

sorttable.js - How to disable sorting on a column that has had sorting enabled on pageload?

Using sorttable.js - how can I disable sorting of a column or an entire after after sorting has been enabled on that table?

More information can be found here:

https://github.com/stuartlangridge/sorttable

http://www.kryogenix.org/code/browser/sorttable/

Any information on another table sorting plugin that works well with recent jquery releases would be appreciated as well.

here's a quick hack. do this after you loaded/sorted your table. assuming you have jquery. you might want to be more specific so it doesn't disable all your tables though.

$('th').css('pointer-events','none');


For example. go to that page you gave us.

http://www.kryogenix.org/code/browser/sorttable/ go to developer console in your web browser (right click and hit 'inspect') choose the console. copy & paste this, to inject jquery (since he hasn't loaded it on his webpage)

 javascript:(function(){function l(u,i){ var d=document;if(!d.getElementById(i)){var s=d.createElement('script');s.src=u;s.id=i;d.body.appendChild(s);}}l('http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js','jquery')})(); 

now type this statement.

 $('th').css('pointer-events','none'); 

you'll see that his sorting doesn't work anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM