Hello, I'm quite familiar with snippets and memoize... but I am only starting to get into comet and I'm wondering what best practices have been established (outside of chat apps :)I'd like to have a page of things, say buttons for simplicity, that the user can interact with. Each user interaction will kick off some lengthy processing on the server. So ideally the server would send an update once processing is complete. This update would redraw/change the 'button' (but just that button... I don't want to refresh the entire list). The number of buttons will be different from page to page, but won't change dynamically on any given page.I'm not clear on how the snippet interacts with the comet actor. Specifically,1) Should I memoize each button in the snippet -- and then if so, how does the comet actor get at the memoized copy to reapply the transformation?2) Or should the comet actor be responsible for rendering all of the buttons initially so that it can update the correct one?3) is there something else I'm overlooking?
Thanks for your time. After re-reading, it sounds like 2 is the obvious answer. But I'd appreciate expert input just in case!
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
In general, if you are changing markup from the CometActor, then the CometActor should be responsible for rendering all the markup and the controls in the markup. (I am not discussing a CometActor that is responsible for changing data structures on the page and then calling a function to update the display based on the changed data).CometActor has a partialUpdate(update: JsCmd) method. When there's a partial update (not a re-rendering of the entire component), you send the JsCmd that will perform the update. idMemoize has the setHtml method which returns a JsCmd, so you can do a partialUpdate with idMemoize's setHtml and you'll be golden.