[jQuery] Tablesorter, something not making sense
The option to fire off "sortStart" and "sortEnd" is cool in that i can
tie in something like BlockUI to give the user some feedback that the
table is being sorted (if it's a really long table, it could take a
second or two, hence my desire for this)
Anyways, if one sets "sortable" to false on a column, the "sortStart"
fires anyways on said column....
$headers.click(function(e) {
$this.trigger("sortStart");
var totalRows = ($this[0].tBodies[0] &&
$this[0].tBodies[0].rows.length) || 0;
if(!this.sortDisabled && totalRows > 0) {
// store exp, for speed
var $cell = $(this);
So a header gets clicked, the code fires off "sortStart", *and then*
it's checked to see if the column is sortable... so one could
hopefully see that my code of:
$(".R_TBL")
.bind("sortStart", function() {
$("#Grid_Block").block({ message:
"Sorting..." });
})
.bind("sortEnd", function() {
setTimeout('$("#Grid_Block").unblock();',
500);
});
Causes a problem when a header i set as "sortable=false" is
clicked.... the blocker is shown, but the event to hide it is never
fired
An obvious fix is to change the code to
$headers.click(function(e) {
var totalRows = ($this[0].tBodies[0] &&
$this[0].tBodies[0].rows.length) || 0;
if(!this.sortDisabled && totalRows > 0) {
$this.trigger("sortStart");
// store exp, for speed
var $cell = $(this);
But i am not really a big fan of modifying others plugin code in case
a service release comes out....
I'm more interested in why that event would be fired before seeing if
it should, and if that reason is valid, what would be a suggestion for
giving user feedback when it's doing it's thing
Thanks
- Stephen