刷新 Flex 组件

发布于 2024-11-24 03:27:30 字数 392 浏览 3 评论 0原文

有没有办法将组件或应用程序刷新回其初始状态?我有一个手风琴导航器,即使我注销,它也会保留在最近选择的索引上。现在,我的注销功能将我带回到状态(1)的登录页面。如果我重新登录并进入手风琴,它位于我查看的最后一个选项卡上。

我希望能够清除导航内控件中的任何数据并将导航重置回默认值。我以为类似的事情

public function logout():void{
  currentState = "NotLoggedIn"
  myAccordion.initialize(); }

会起作用,但什么也没发生。这是在 Flex 4 中完成的。

我知道我可以做一个巨大的循环,单独清除每个控件并将手风琴的 selectedIndex 设置为 0。我希望有一个更简单的解决方案。

Is there a way to refresh a component or an application back to its initial state? I have an accordion navigator that stays on the most recently selected index even if I log out. Right now, my log out function takes me back to the login page which is at state(1). If I log back in and go into the accordion, it is on the last tab I had viewed.

I would like to be able to clear any data from the controls inside the nav and reset the nav back to its default. I thought something like,

public function logout():void{
  currentState = "NotLoggedIn"
  myAccordion.initialize(); }

would work but nothing happens. This is done in Flex 4.

I know I can make a huge loop clearing each control individually and setting the selectedIndex of the accordion to 0. I was hoping for a simpler solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

源来凯始玺欢你 2024-12-01 03:27:31

这取决于你所说的“国家”是什么意思。

如果您已在 Flex 组件中实现了状态,则可以使用以下方法恢复到以前的状态:

component.currentState = 'myInitialState';

如果您不是明确谈论状态,而是谈论组件属性的内部值,则 Flex 不会保留历史记录这些财产价值。您可以自己跟踪它们并手动重置它们。

一旦你这样做了,你的组件将实际上处于初始状态。

It depends what you mean by "State".

If you have implemented states in your Flex Component, you can revert back to a previous state using:

component.currentState = 'myInitialState';

If you are not talking about states, explicitly, but rather about the internal values of the properties of the component, then Flex does not keep a history of those property values. You can keep track of them yourself and reset them in the manually.

Once you do that, your component will be, effectively, in the initial state.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文