help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Iliad - updating elements


From: Stefan Schmiedl
Subject: Re: [Help-smalltalk] Iliad - updating elements
Date: Mon, 13 Jul 2009 17:41:19 +0200

On Mon, 13 Jul 2009 15:05:24 +0200
Nicolas Petton <address@hidden> wrote:

> Le lundi 13 juillet 2009 à 14:50 +0200, Stefan Schmiedl a écrit :
> > Before I dive in and learn to do it manually, is there an idiomatic
> > way of updating a given element (periodically)?
> > 
> > I am building the supervisor page for the OnlineTester, which
> > contains something like a "dashboard" showing the completion rate
> > of each test. This is currently implemented as widget although
> > it does not need to be, now that I think about it. Anyways, its
> > contents should be refreshed once every minute.
> 
> You should probably use one of the periodical updater jQuery plugins.
> http://plugins.jquery.com/search/node/updater

Smart solutions for a bigger problem :-)

> There is no integration in Iliad for now, so you will have to write
> some Javascript code ;)

Here's what I have now, but consider cheating (a bit):

  contents [ 
    <category: 'building'>
    ^ [ :e | |id|
      id := self session nextId printString.
      e build: self statusWidget.
      e anchor id: id; text: 'Refresh'; action: [ self statusWidget markDirty ].
      e script: 'window.setInterval( function() { jQuery( "a#' , id , '" 
).click(); }, 60*1000 );'
    ]
  ]

Question #1: 
Is there a reason why "session nextId" is a number instead of a string?
It does not matter when assigning it to the id attribute, but it is a bit of a 
trap
because splicing it (as a number) into a string does not give the desired 
result.

Question #2:
The solution above nicely logs the expected XHR requests in firebug.
When I tried 
            Iliad.evaluteAnchorAction( "a#' , id , '" );
instead, no such requests were logged. Do I actually go and read the Javascript
books on the shelf behind me or is there something else I'm not aware of?

Thanks,
s.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]