0

Using Block UI --> Block UI

I'm trying to make the "Loading" message appear before the page starts to load and while the page is loading.

See this jsFiddle --> http://jsfiddle.net/wx9F3/22/

Narrow the search down to a couple of part numbers using the textboxes at the top and then click "reset". The page will start to load and THEN the "Loading" message appears. I need this to happen before the page starts to load and while the page is loading.

$('#clearBtn').on('click', function() {
    $.blockUI({message: '<h3>Loading</h3>',timeout: 2000}); 
    $('.modx').val('').trigger('keyup');
});

Does anyone know how to fix this?

1 Answer 1

1

It is because your function on triggered with keyup event it making the browser gag, I do not have the time to check the whole function, but you should look into it.

As a quick fix, do not set timeout for blockui, and add a delay in calling keyup, like this:

  $.blockUI({message: '<h3>Loading</h3>'}); 
  setTimeout(function(){$('.modx').val('').trigger('keyup');},500); 

Than at the end of keyup function just add a call to release the blocked ui, like this:

 $.unblockUI(); 

See the full fiddle here, but please I will like to STRETCH out this is just a patch, to get it working you should really sort out your function which causes the halt.

Emil

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! I have to trigger the keyup function in order to reset the filters. This was actually a suggestion by the creator of Table Sorter 2.0
Sorry probably I have expressed myself wrongly it's not the trigger which makes the browser struggle, it is the whole filter reset function. As an alternative to your actual table try to have a look at datatables.net imho it's the best table handling framework.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.