Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:45:19+00:00 2026-06-17T11:45:19+00:00

I wonder if that would be possible: During an event I would like to

  • 0

I wonder if that would be possible:

During an event I would like to check certain condition, if that condition is true, I would like to cancel the event right away.

In the case below, if this condition is met, I would like to disallow the user of sorting the table at all.

$(table).bind("sortBegin",function(e, table) { 
   if(condition_is_met){
     // ?? How to cancel the sortBegin?
   }

});

Is something like this possible in jquery?

Update:

Apologies,

1)I thought tagging tablesorter would be clear enough to indicate which plugin I am using. 😉 Anyway tablesorter it is. Thanks

2) I would like to disallow sorting of any kind until the condition isn’t met anymore. I don’t mind if the whole table would be stopped from sorting or only the current event.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:45:21+00:00Added an answer on June 17, 2026 at 11:45 am

    Unfortunately the plugin didn’t think about preventDefault – you either need to modify it or throw an exception to abort the
    call stack, which should be effectively the same as a well supported preventDefault but uglier.

    $(table).bind("sortBegin",function(e, table) { 
       if(condition_is_met){
         throw new Error("");
       }
    
    });
    

    IIRC, .trigger() in jQuery works synchronously, if this is true then this will work.

    If you want to modify the plugin, this is how you can add support for preventDefault:

    var e = $.Event( "sortBegin" );
    $this.trigger(e, $t0);
    if( !e.isDefaultPrevented() ) {
        setTimeout(function(){
            // set css for headers
            setHeadersCss($t0);
            multisort($t0);
            appendToTable($t0);
        }, 1);
    }
    

    Now when the client of the code calls e.preventDefault() in a sortBegin-event, the plugin would not proceed with sorting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder is it possible to have a map that would work like boost
I wonder if it's possible to add an Event Listener to a MovieClip that
I would like to customize my input a little and I wonder if that
I wonder how PHP handles true/false comparison internally. I understand that true is defined
I wonder if it is possible to modify a wildcard expression that uses *
I wonder whether it would be possible to implement something similar to http://bit.ly/MEdfiq using
I'm implementing on some C++ code that I would like to make as portable
I wonder if the following is possible: I have a dll that I have
I wonder if something like this is possible: Application AA uses Androids class MediaPlayer
I wonder that what is the best way of writing a component for joomla

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.