我有一个非常简单的事情:呈现一些项目的数据网格。点击一个项目会弹出一个弹出编辑器(因为该项目有很多属性,可能不会在数据网格中编辑)。datagrid项目弹出编辑器 - 挂起浏览器
弹出窗口只包含一个表单和[Bindable]引用它所编辑的项目(它是从datagrid的itemClick处理程序传递的)。通过使用{}概念绑定到相应的项目属性来获取表单的默认值,而使用mx:Binding标签将表单值绑定回该项目。
和现在的问题。当弹出窗口第一次出现时,一切都很好。然而,当关闭弹出窗口后,通过点击相同的项目再次出现,浏览器挂起(afaik因为更改观察者无休止地被触发,导致stackoverflow或类似的东西)。
我们在Safari,IE和Chrome中有相同的行为,所以我想这不是与浏览器相关的事情。从弹出窗口中的项目引用中删除[Bindable]或从编辑器中删除mx:Binding标记可以解决问题,但编辑不再起作用。
我已经把我的头靠在墙上撞了好几天了,但还是无法让它工作。它是否会对某人敲响警钟,在这里有什么可能是错误的(这可能会更容易)?
这里的弹出窗口的代码:
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="Details"
showCloseButton="true" close="PopUpManager.removePopUp(this);" creationComplete="PopUpManager.centerPopUp(this)">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import my.Detail;
[Bindable] private var _documentDetail:Detail;
public function set documentDetail(value:Detail):void {
this._documentDetail = value;
}
public function set readOnly(value:Boolean):void {
if (value) {
this.currentState = "read-only";
}
}
]]>
</mx:Script>
<mx:states>
<mx:State name="read-only">
<mx:SetProperty target="{startDate}" name="enabled" value="false"/>
<mx:SetProperty target="{comments}" name="enabled" value="false"/>
</mx:State>
</mx:states>
<!--
<mx:Binding source="this.startDate.selectedDate" destination="_documentDetail.startDate"/>
<mx:Binding source="this.comments.text" destination="_documentDetail.comment"/>
-->
<mx:VBox width="100%" height="100%">
<mx:FormItem label="{resourceManager.getString('eRequestAppli','startdate')}:" labelWidth="160" width="100%">
<mx:DateField id="startDate" width="100%" selectedDate="{_documentDetail.startDate}" formatString="{resourceManager.getString('eRequestAppli', 'dateformat')}" editable="false"/>
</mx:FormItem>
<mx:FormItem label="{resourceManager.getString('eRequestAppli','comments')}:" labelWidth="160" width="100%" height="79">
<mx:TextArea id="comments" width="100%" height="100%" text="{_documentDetail.comment}" editable="false"/>
</mx:FormItem>
</mx:VBox>
</mx:TitleWindow>
这里就是我称之为:
private function show(detail:Detail, readOnly:Boolean=false):void {
var popup:fxc_ProposalDetail =
fxc_ProposalDetail(PopUpManager.createPopUp(UIComponent(Application.application), fxc_ProposalDetail, true));
popup.documentDetail = detail;
popup.readOnly = readOnly;
}
一些示例代码会有帮助,特别是负责设置绑定的示例代码。 – 2010-09-10 08:40:17
添加了调用代码和弹出代码 – 2010-09-10 13:41:41