【发布时间】:2014-02-24 13:50:33
【问题描述】:
我有两种情况需要帮助,我认为将它们一起发布会更有效 对我自己和其他观众都很有价值。
设置:
Worklight 6.1
dojo 1.9
Application:
MainView.html (Contains Body, and a transition Div, and NorthSouthView.js script reference)
View1.html (Contains a single Div that displays and unordered list
View2.html (Contains a single Div that Displays <p> data, and also plays audio)
View3.html (Contains a single Div that Displays instructional information)
application-descriptor <mainFile> MainView.html </mainFile>
All of the views are stored together in the application. There are no external http queries made by the application. All view transitions are local to the application.
场景#1:
At application start the MainView.html is invoked by worklight. Anticipated format::
<body>
<div>
<h1 id="SSheader" data-dojo-type="dojox.mobile.Heading" data-dojo-props='fixed:"top"'>Loan Snapshot</h1>
</div>
<div id="TransitionViewDiv">
/* Would like to load content of View1.html, View2.html, or View3.html here */
</div>
<script>SetView.js</script>
</body>
Description + Questions:
When the application starts, SetView.js will be loaded, and the purpose of this script is to look at localStorage and determine which view should be displayed. (View1, View2, or View3). The goal is to keep SSheader fixed at the top of the screen at all times. Only TransitionViewDiv would update.
问题:
1) What coding approach can be used in SetView.js to load one of the 3 possible views into the TransitionViewDiv?. I did findin dojo 1.9 specs an example using dojox/mobile/ViewController but I was not able to get the sample code to work as documented by dojo.
2) Is the approach of having the TransitionViewDiv necessary, or could View1, 2 or 3 be loaded without TransitionViewDiv? Keep in mind that each view View1, 2, and 3 are defined as individual Div's.
感谢完成上述方法的任何建议,或欢迎有关完成过渡的最佳实践的任何建议。
场景 #2:
作为上述场景 1 的后续。成功加载 View1、2 或 3 后,视图将定义按钮,这些按钮将导致转换到其余视图中的另一个。因此,如果在 SetView.js 中决定在 View2 中滑动以显示,View2 将具有要加载的按钮,例如 View3.html。
描述+问题:
1) 从 View2.html 加载 View3.html 的最佳方法是使用按钮单击时的 moveTo,还是按钮使用回调来调用 javascript 以导致类似于用于加载初始视图?
感谢有关管理存储在独立文件中的多个视图的最佳实践的任何建议。最后,该应用程序将拥有超过 15 个以上的 ViewXX.html 文件,每个文件都包含一个 Div。基于此,将所有视图放在一个 html 文件中并强制隐藏和显示是不可行的。
感谢您的时间和帮助
【问题讨论】:
标签: dojo ibm-mobilefirst worklight-studio