简体   繁体   中英

Flex - Clearing DateField value on tab change in TabNavigator

I have the following tab navigator, which has a Project tab, containing a Combobox next to Release label as follows( AdditionalDetails.mxml) : 在此处输入图片说明

Same tab navigator is having a Gate2 tab, which contains a DateField next to the label CERT load date , which can be seen below( Gate2.mxml ): 在此处输入图片说明

Now, when I select Release as TBD on Project tab, an alert box appears as follows: 在此处输入图片说明

On clicking YES , I want to clear the DateField on Gate2 tab. How can I do so? Code for Combobox(AdditionalDetails.mxml):

<mx:ComboBox id="General_Release_Dates"
                     selectedItem="{modelProxy.General_Release_Dates}"
                     valueCommit="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}"
                     change="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}" close="closeHandler(event);" includeInLayout="true" visible="true">
        </mx:ComboBox

Code for handling YES click on Alert box:

private function alertClickHandler(evt:CloseEvent):void {
if (evt.detail == Alert.YES) { //Code to clear DateField}

DateField code on Gate2 tab( Gate2.mxml ): DateField code: <mx:DateField id="G2_CRTLoadDate" width="150" selectedDate="{modelProxy.G2_CRTLoadDate}" change="{modelProxy.G2_CRTLoadDate = event.currentTarget.selectedDate;changeManagerStatus()}"/>

Updated: Aug 31 23:27(JST)

If you're using singleton Flex - Problems in accessing static variable on another mxml page

1) Create variable at your MySingleton class like below.

    private var _gate2:Object;

    public function set gate2(value:Object):void
    {
        _gate2 = value;
    } 

    public function get gate2():Object
    {
        return _gate2; 
    }

2) Gate2.mxml (write at creationComplete event)

singleton.gate2 = this;

3) Control Gate2 from external class.

private function alertClickHandler(evt:CloseEvent):void {
    if (evt.detail == Alert.YES) {
        //Code to clear DateField

        singleton.gate2.G2_CRTLoadDate.selectedDate = null;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM