AutoComplete

艾奕
2023-12-01

Quick tip: Avoid issues using Adobes AutoComplete Input component using Flex 3

 

 

http://www.websector.de/blog/2008/04/30/quick-tip-avoid-issues-using-adobes-autocomplete-input-component-using-flex-3/

 

上面的地址有很好的实现,需要时可以参考。

 

下面是AH中调用时的部分代码,仅作参考:

 

<component:AutoComplete x="10" y="71" width="306" id="acboxClient" maxChars="100" doubleClickEnabled="true" doubleClick="doubleClick_acboxClient()"

text="" forceUpperCase="true" forceMatch="true" dataProvider="{groupModel.groupRelationshipList}"

styleName="BodyText" height="23" change="clientChange()"/>

 

private function doubleClick_acboxClient():void {

                                    //this.acboxClient.selectWholeWord();

                                    //this.acboxClient.text = "";

                                    //this.acboxClient.selectedIndex = -1;

                                    this.acboxClient.typedText = "";

}

 

private function clientChange():void {

                                var selectedClient:PFAcctHierarchy = acboxClient.selectedItem as PFAcctHierarchy;

                                /* not use 'selectedClient != this.lastSelectedClient' is because:

                       *  every time click the right-top GroupMaintenance Tab, groupGUI will be set blank. And

                                *  if user then choose the client as the last one, GUI should reload it,

                                *  so comment out this, and 'lastSelectedClient' is no longer used.

                                */

                                //if(selectedClient != null && selectedClient != this.lastSelectedClient) {

                                if(selectedClient != null) {

                                                this.lastSelectedClient = selectedClient;

                                                addGroupBtn.enabled = true;

                                                var cid:Number = new Number(selectedClient.pfId);

                                                var pfClientAcronym:String = selectedClient.pfClientAcronym;

                                                groupModel.clientAcronym = pfClientAcronym;

                                                GroupControl.findGroup(cid, pfClientAcronym);

                                                               

                                                // retain last visited group info

                                                groupModel.groupLastVisited.pfClientManagerId = cid;

                                                groupModel.groupLastVisited.pfClientAcronym = pfClientAcronym;

                                                groupModel.groupLastVisited.groupId = null;

                                                groupModel.groupLastVisited.pfGrpId = 0;

                                                               

                                                groupModel.detailVisiable = false;

                                                               

                                                Application.application.focusManager.setFocus(groupDetail);

                                                               

                                }

}

 类似资料: