Le lundi 13 juillet 2009 à 17:41 +0200, Stefan Schmiedl a écrit : > On Mon, 13 Jul 2009 15:05:24 +0200 > Nicolas Petton <[email protected]> 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?
Hmm, yes. As far as I remember, numbers are needed to know in which order actions need to be executed, in a form for instance. But I don't think you need Session>>nextId, it is mostly used for actions registration. You could use Iliad.Id instead. Also, #nextId may not be the appropriate name, since it answers an integer. If someone has a better name in mind... > 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? Iliad.evaluateAnchorAction(anchor) expects a DOM element, not an id. So Iliad.evaluateAnchorAction(jQuery(#someId)) should work. HTH, Nico
signature.asc
Description: Ceci est une partie de message numériquement signée
_______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
