[Dojo-interest] Problem dynamically loading headings/toolbars
slacker at engineer.com
Sun May 27 18:16:09 EDT 2012
Hello again Adrian,
For closure on this post I wanted to let you know that I have now resolved my problem! And of course, your advice to revisit the test cases - again - provided the solution.
Instead of continuing to make my existing code work, I took the rip-up-and-retry approach, and designed again from scratch, validating with modified test cases - and went rather directly to a working app!
Clearing the work area is always helpful with problem implementations, and I suppose starting fresh with the dojo familiarity gained over the past couple of weeks did not hurt!
So, for completeness for anyone with a similar need, I now handle it like this:
1. Page HTML now includes two empty calendar ScrollableViews - cal1 and cal2
2. Top level "li" onclick() calls my own loadCal(li,mn,yr) handler with NULL mn-yr as default
3. loadCal() detects if any calendar has been previously loaded via loadCal.state var
3.a If not loaded, uses xhrGet() to fetch current cal into cal1.containerNode (parse(cal1.containerNode), transition to cal1 in callback)
3.b If previously loaded, simply transitions to existing state of cal1
4. Fetched calendar content includes ToolBarButtons encoded for previous/next month, onclicks to loadCal()
5. When ToolBarButton is selected loadCal() determines current/next view states -
5.a next.destroyDescendants(), xhGet()->next.containerNode.innerHTML, then parse(next.containerNode)
5.b current.performTransition(next..., callback())
5.c Transition callback: If xhrGet() was to cal2 then destroy/set cal1 containerNode = cal2 containerNode
6. When user returns to top level, then uses "li" to re-enter calendar, they always see cal1 which is always last state
The loadCal() handler including xhrGet() callback and all handling is now clean and compact - much better than before.
Now I wonder what I was trying to do before that was so awful! Thanks for the focus!
----- Original Message -----
From: Adrian Vasiliu [via Dojo Toolkit]
Sent: 05/26/12 02:23 AM
Subject: Re: Problem dynamically loading headings/toolbars
Maybe you did it already, but if not, you may want to search in dojox/mobile/tests for a closest match to your needs. I'm not sure there's one doing exactly what you want, but some are doing ajax loading of content.
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
[hidden email] /user/SendEmail.jtp?type=node&node=3985788&i=0
If you reply to this email, your message will be added to the discussion below:http://dojo-toolkit.33424.n3.nabble.com/Problem-dynamically-loading-headings-toolbars-tp3985785p3985788.html
To unsubscribe from Problem dynamically loading headings/toolbars, click here http://dojo-toolkit.33424.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3985785&code=c2xhY2tlckBlbmdpbmVlci5jb218Mzk4NTc4NXwxMzEzNjM3NTU5 .
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Problem-dynamically-loading-headings-toolbars-tp3985785p3985825.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Dojo-interest