From: Jorge on
On Jan 13, 11:41 am, David Mark <dmark.cins...(a)gmail.com> wrote:
> (...) Somebody generalizing about how to write efficient
> "Web 2.0" apps (or whatever?) (..)

Yeah, sure. Obviously you have not seen it yet. But you should.
--
Jorge.
From: David Mark on
Jorge wrote:
> On Jan 13, 11:41 am, David Mark <dmark.cins...(a)gmail.com> wrote:
>> (...) Somebody generalizing about how to write efficient
>> "Web 2.0" apps (or whatever?) (..)
>
> Yeah, sure. Obviously you have not seen it yet. But you should.

No I shouldn't, but thanks for thinking of me.
From: Stefan Mueller on
On Jan 13, 3:12 am, Jorge <jo...(a)jorgechamorro.com> wrote:
> Stefan,
>
> All you need to do is to wrap the whole thing in a setTimeout
> (sortingCode ,0); That will warrant a redraw *before* it executes.
> Like this:
>
> elem.onclick= function onclick () {
>   elem.onclick= null; //trash useless double-clicks
>   setTimeout(function () {
>
>     //Put your sorting code here.
>
>     elem.onclick= onclick;
>   }, 0);};
>
> --
> Jorge.

Jorge,

I tried to implement setTimeout but I'm not sure if I did it correct
(the way you advised me to do):
var_this_global = this;
var_todo_global = "function_sort(var_this_global);";
setTimeout(var_todo_global, 1200);

It only works if I set the value in setTimeout to at least 1200. It
works if you click a second time on a column header while the sorting
is running. But it doesn't work if you click a third time.
Because I have to set the value to at least 1200 it always takes 1.2
seconds until the sorting starts.

Stefan
From: David Mark on
Stefan Mueller wrote:
> On Jan 13, 3:12 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>> Stefan,
>>
>> All you need to do is to wrap the whole thing in a setTimeout
>> (sortingCode ,0); That will warrant a redraw *before* it executes.
>> Like this:
>>
>> elem.onclick= function onclick () {
>> elem.onclick= null; //trash useless double-clicks
>> setTimeout(function () {
>>
>> //Put your sorting code here.
>>
>> elem.onclick= onclick;
>> }, 0);};
>>
>> --
>> Jorge.
>
> Jorge,
>
> I tried to implement setTimeout but I'm not sure if I did it correct
> (the way you advised me to do):

That's assuming Jorge advised you correctly (usually a stretch). As I
mentioned, you don't really have a problem. If your process takes too
long (and it definitely does), you need to break it up. Then the clicks
(or whatever user actions) will not be "cached" while the engine is
waiting for your sort to finish. Solve the real problem and the
imagined one will go away. ;)

> var_this_global = this;
> var_todo_global = "function_sort(var_this_global);";
> setTimeout(var_todo_global, 1200);
>
> It only works if I set the value in setTimeout to at least 1200. It
> works if you click a second time on a column header while the sorting
> is running. But it doesn't work if you click a third time.
> Because I have to set the value to at least 1200 it always takes 1.2
> seconds until the sorting starts.
>

You are wasting your time. Do what I told you to do. You can't go
wrong that way.
From: Jorge on
On Jan 14, 9:54 am, Stefan Mueller <seekw...(a)yahoo.com> wrote:
> On Jan 13, 3:12 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>
>
>
>
>
> > Stefan,
>
> > All you need to do is to wrap the whole thing in a setTimeout
> > (sortingCode ,0); That will warrant a redraw *before* it executes.
> > Like this:
>
> > elem.onclick= function onclick () {
> >   elem.onclick= null; //trash useless double-clicks
> >   setTimeout(function () {
>
> >     //Put your sorting code here.
>
> >     elem.onclick= onclick;
> >   }, 0);};
>
> > --
> > Jorge.
>
> Jorge,
>
> I tried to implement setTimeout but I'm not sure if I did it correct
> (the way you advised me to do):
>   var_this_global = this;
>   var_todo_global = "function_sort(var_this_global);";
>   setTimeout(var_todo_global, 1200);
>
> It only works if I set the value in setTimeout to at least 1200. It
> works if you click a second time on a column header while the sorting
> is running. But it doesn't work if you click a third time.
> Because I have to set the value to at least 1200 it always takes 1.2
> seconds until the sorting starts.

Ok. check this one:
http://jorgechamorro.com/cljs/092/

Does it work for you ?
--
Jorge.