Hi group,
I'm trying to add a busy indicator to the sorttable.js code available
at: http://www.kryogenix.org/code/browser/sorttable/
(Actually, my version is modified for my needs, such as maintaining
zebra stripes post-sort, multi-column sorting, keeping rows with
subordinate rows together. But my problem exists even with the original
code).
I've implemented a function to turn change a 'progress' div:
function busyProgress(m) {
if (document.getEl ementById("prog ress")) {
var myEl = document.getEle mentById("progr ess");
myEl.innerHTML = (m) ? 'Busy, please wait...' : '';
}
}
This works great with something like an Ajax function, but with
sorttable.js, the 'progress' div's contents never change. Note that I'd
use something like document.body.c ursor.style = 'wait' as well, but
Firefox won't change the cursor style unless the mouse is moved.
If I insert an alert() right after the innerHTML line, then I see the
div's contents being changed.
If I insert a simple delay (using new Date().getTime, and looping until
the desired time has passed), the div's contents do not change.
This is a concern since a number of the tables I need to present, and
wish to allow in-browser sorting, have a few hundred rows. The sort
will complete, but I have been unable to provide a visual indicator
that the sort is in progress.
Has anyone else attempted to do this and had success?
Thanks for any assistance you can provide. 5 5574 es******@gmail. com said the following on 10/4/2005 8:59 PM: Hi group,
I'm trying to add a busy indicator to the sorttable.js code available at: http://www.kryogenix.org/code/browser/sorttable/
(Actually, my version is modified for my needs, such as maintaining zebra stripes post-sort, multi-column sorting, keeping rows with subordinate rows together. But my problem exists even with the original code).
I've implemented a function to turn change a 'progress' div:
function busyProgress(m) { if (document.getEl ementById("prog ress")) { var myEl = document.getEle mentById("progr ess"); myEl.innerHTML = (m) ? 'Busy, please wait...' : ''; } }
This works great with something like an Ajax function, but with sorttable.js, the 'progress' div's contents never change. Note that I'd use something like document.body.c ursor.style = 'wait' as well, but Firefox won't change the cursor style unless the mouse is moved.
If I insert an alert() right after the innerHTML line, then I see the div's contents being changed.
If I insert a simple delay (using new Date().getTime, and looping until the desired time has passed), the div's contents do not change.
This is a concern since a number of the tables I need to present, and wish to allow in-browser sorting, have a few hundred rows. The sort will complete, but I have been unable to provide a visual indicator that the sort is in progress.
Has anyone else attempted to do this and had success?
Thanks for any assistance you can provide.
Call busyProgress, and set a timeout to call your sort function. The UA
does not update until the function finishes. As long as its sorting -
the UA wont change displays. The alert you use causes the function to
stop until the alert is dismissed, so the UA updates.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Randy Webb wrote: es******@gmail. com said the following on 10/4/2005 8:59 PM:
Hi group,
I'm trying to add a busy indicator to the sorttable.js code available at: http://www.kryogenix.org/code/browser/sorttable/
[...] I've implemented a function to turn change a 'progress' div:
function busyProgress(m) { if (document.getEl ementById("prog ress")) { var myEl = document.getEle mentById("progr ess"); myEl.innerHTML = (m) ? 'Busy, please wait...' : ''; } }
[...] If I insert an alert() right after the innerHTML line, then I see the div's contents being changed.
If I insert a simple delay (using new Date().getTime, and looping until the desired time has passed), the div's contents do not change.
This is a concern since a number of the tables I need to present, and wish to allow in-browser sorting, have a few hundred rows. The sort will complete, but I have been unable to provide a visual indicator that the sort is in progress.
[...] Call busyProgress, and set a timeout to call your sort function. The UA does not update until the function finishes. As long as its sorting - the UA wont change displays. The alert you use causes the function to stop until the alert is dismissed, so the UA updates.
That's a good idea (I think) but there are some usability issues.
Events are buffered while the function runs, so if users are impatient
and try clicks & drags in the meantime (e.g. they click on three or four
'sort' do-dads while the first is running), nothing will happen until it
finishes and then the others will run. Users may consider the
unexpected results to be the OP's fault.
The OP may want to put a div over the entire page or employ some other
tactic to prevent user intereaction with the page while the script runs.
Some play stuff below (the pause function should never be used in a real
page, it's just a quick hack to force a pause).
<script type="text/javascript">
function runThing( thing )
{
toggleMsg();
setTimeout(thin g + '(1000);', 10);
}
// This thing just pauses for a short time... hogs the processor!
function doPause( ms )
{
var now = new Date();
var t = now.getTime() + +ms;
while ( now.getTime() < t ){
now = new Date();
}
toggleMsg();
}
function toggleMsg()
{
var d = document.getEle mentById('msg')
d.style.display = ('none' == d.style.display )? '' : 'none';
}
</script>
<div id="msg" style="font-size: 300%; font-weight: bold;
position: absolute; top: 100px; left: 150px; display:
none;">Wait&hel lip;</div>
<input type="button" value="Run it" onclick="runThi ng('doPause');" >
--
Rob
RobG said the following on 10/4/2005 11:19 PM: Randy Webb wrote:
es******@gmail. com said the following on 10/4/2005 8:59 PM:
Hi group,
I'm trying to add a busy indicator to the sorttable.js code available at: http://www.kryogenix.org/code/browser/sorttable/ [...] I've implemented a function to turn change a 'progress' div:
function busyProgress(m) { if (document.getEl ementById("prog ress")) { var myEl = document.getEle mentById("progr ess"); myEl.innerHTML = (m) ? 'Busy, please wait...' : ''; } } [...]
If I insert an alert() right after the innerHTML line, then I see the div's contents being changed.
If I insert a simple delay (using new Date().getTime, and looping until the desired time has passed), the div's contents do not change.
This is a concern since a number of the tables I need to present, and wish to allow in-browser sorting, have a few hundred rows. The sort will complete, but I have been unable to provide a visual indicator that the sort is in progress. [...]
Call busyProgress, and set a timeout to call your sort function. The UA does not update until the function finishes. As long as its sorting - the UA wont change displays. The alert you use causes the function to stop until the alert is dismissed, so the UA updates.
That's a good idea (I think) but there are some usability issues.
Events are buffered while the function runs, so if users are impatient and try clicks & drags in the meantime (e.g. they click on three or four 'sort' do-dads while the first is running), nothing will happen until it finishes and then the others will run. Users may consider the unexpected results to be the OP's fault.
Have the function set a variable when it runs, and checks for that
variable prior to running. When it finishes, reset the variable.
var functionRunning = false
function something(){
if (functionRunnin g){return false;)}
else{
functionRunning = true;
//function is not already running so it will execute.
}
functionRunning = false;
}
Might be some flawed logic there, its 2am and typing off my head, but
the general idea is there.
Or, and maybe better, is to check the visibility of the div. If its
visible, fire off. If not, don't. And overly the entire page. The
problem with that is you end up with users that say "I clicked and
clicked and nothing happened". Might be better with an : alert('Be
Patient, I am slowly sorting this monster table');
Or, overlay the page with a div with z-index to cover it all with a
"Sorting table...." like a download status bar or something. Some
animated gif or such to let the user know the browser is busy. Doing
this would avoid the variable situation above.
The OP may want to put a div over the entire page or employ some other tactic to prevent user intereaction with the page while the script runs.
See Above :)
Some play stuff below (the pause function should never be used in a real page, it's just a quick hack to force a pause).
It's ironic that you would use that tactic. Its irony is that I was
looking through the archives of clj earlier and ran across this thread:
<URL: http://groups.google.com/group/comp....6cf6eeca835f6d
Which discusses the ramifications of giving code such as the pause
function and its problems, especially with new people :)
No biggie, just found it ironic was all.
function doPause( ms ) { var now = new Date(); var t = now.getTime() + +ms; while ( now.getTime() < t ){ now = new Date(); } toggleMsg(); }
But, that function would "hog" the CPU (as noted) where a setTimeout
might work better. <shrug> Its 2AM and I need sleep.....
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Randy Webb wrote: Call busyProgress, and set a timeout to call your sort function. The UA does not update until the function finishes. As long as its sorting - the UA wont change displays. The alert you use causes the function to stop until the alert is dismissed, so the UA updates.
Thanks, Randy.
When said in your short, to the point fashion, it all makes sense now.
I'd seen mention of that technique in other threads/blogs, but for
whatever reason, those solutions didn't seem all that applicable to
this situation.
Found an easy way to do this :
step 1. change cursor
function ts_makeSortable
add this line before "onclick" :
onMousedown="th is.style.cursor ='wait';"
so that cursor is changed *before* the (long) sort process starts
step 2. restore cursor
function ts_resortTable
add this line at the bottom :
lnk.style.curso r='default';
Works great with IE and Firefox.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim Hansen |
last post by:
I re-installed Framework and now I am getting this error ClassBrowser. Most
other page work just fine. Additionally, the debugger will not start from
Visual Studio 2003..
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'SortTable' is...
|
by: Koen Janssens |
last post by:
Can anybody give me an example on how to write a progress indicator in C++
using the standard library cerr or cout?
My problem is I do not know how reset the output stream to the beginning of
the line, so just that information will do fine.
Thanks - Koen
|
by: Andrew |
last post by:
Hello,
Is it possible for a file position indicator of an input stream to be
greater than the size of a file? And if so could this cause fgetc to
somehow write to the file? For example is it possible to continually
call fgetc past the size of the file and cause some type of undefined
behavior? Thanks
|
by: Paul |
last post by:
Just wondering if there is a way to set up a web application where the curser
turns into an hour glass when the application is busy, for example processing
a stored procedure on a server that takes several seconds?
Thanks.
--
Paul G
Software engineer.
|
by: Paul Bromley |
last post by:
Can someone give me a pointer of the best way to show that an application is
busy and has not locked up?
I am writing a utility to search a network drive for a number of tiff files.
I will possibly be searching thousands of subdirectories for tens of
thousands of files. I obviously will not know in advance how many files. I
assume to use a process bar you need to know this?
Many thanks yet again
| |
by: Marko Vuksanovic |
last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
A link to example would also be useful.
Thanks,
Marko Vuksanovic.
|
by: Frank Swarbrick |
last post by:
A few weeks ago I had posed a question about how one my create a cursor for
a query where the predicate condition is dynamic. Meaning that the query
might want to have one of several possible predicates. Take the following
queries, for instance:
-- check for branch/account and amount
SELECT BRCH_NBR, ACCT_NBR, POST_DATE, AMOUNT, SERIAL_NBR, SEQUENCE_NBR,
POST_FLAG
FROM FILM.FILM_TRANSACTIONS
WHERE BRCH_NBR = 001 AND ACCT_NBR =...
|
by: =?Utf-8?B?amV6MTIzNDU2?= |
last post by:
Hi Experts
I have a C# Windows application where sometimes it can take upto 20 seconds
to switch between different forms. At the moment I show a 'Processing, please
wait' dialog while the next form is loading.
Using the background worker, I've tried including progressbars and other
custom busy indicators on the dialog. These all work in a jerky kind of way,
ie their motion is not smooth.
|
by: nicolas.sitbon |
last post by:
Hi everybody, in a french C book, the author says that only {fgetc,
getc, getchar, fgetwc, getwc, getwchar, fgets, gets, fgetws, getws,
fputc, putc, putchar, fputwc, putwc, putwchar, fputs, puts, fputws}
are guaranteed to set the end-of-file indicator when the end-of-file
is reached, but in C99 standard, I find p 288 (ISO/IEC 9899:TC3
Committee Draft — Septermber 7, 2007 WG14/N1256)
/* ============================= */
#include <stdio.h>...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |