Flex Spark tabbar:初始化隐藏选项卡
问题是我有一个 Spark 选项卡,每个选项卡中有许多表单。 但我有一个全局保存按钮。问题是,如果我不打开选项卡, 它没有被初始化,因此它包含的表单不存在。
我怎样才能让它看起来就像用户单击了每个选项卡一样?
problem is I have a spark Tabbar, with many forms in each tab.
But I have a single global save button. Problem is, if I don't open a Tab,
it doesn't get initialized and therefore the forms it contains do not exist..
How Can I make it as if the user had clicked on every tab?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
处理此问题的最佳方法是拥有每个选项卡都显示和编辑的数据模型,而不是尝试进入每个选项卡中的控件并读取值,然后保存这些值。这是 MVC 的核心。
但是,如果您对当前架构投入太多而无法更改它,并且您在 TabBar 中使用 ViewStack,您可能会发现将creationPolicy 设置为“all”可以满足您的需求。如果您正在使用状态,我认为您不能在不将应用程序至少放入每个状态一次的情况下强制实例化所有状态。
The best way to handle this is to have a data model that each tab is displaying and editing, rather than trying to go in and read the values out of the controls in each tab, and save those. This is at the heart of MVC.
However, if you're too invested in your current architecture to be able to change it and you are using a ViewStack with your TabBar, you may find that setting creationPolicy to "all" does what you want. If you're using States, I don't think you can force all of them to be instantiated without putting your application into each State at least once.