flex3 comboBox 변신 필터링 가능한 검색 드롭다운 옵션, 실례 코드 세션 입력 가능
<fx:Script>
<![CDATA[
...............
private var enterpriseInfoRO:RemoteObject=ServiceLocator.getInstance().getRemoteObject("enterpriseInfo_RO_ID") as RemoteObject;
private var reportRO:RemoteObject=ServiceLocator.getInstance().getRemoteObject("reportRO") as RemoteObject;
[Bindable]
private var enterprise_info:Array=[];
[Bindable]
public var inputEStr:String;
private var checkBox:CheckBox;
[Event(name="onDocumentLoadedError", type="flash.events.ErrorEvent")]
............
//
public function loadEnterpriseInfo():void
{
enterpriseInfoRO.getEnterprisesListByTID(cityInfo_CB_ID.selectedItem.value);
enterpriseInfoRO.addEventListener(ResultEvent.RESULT, enterpriseInfo_Handle);
}
public function enterpriseInfo_Handle(e:ResultEvent):void
{
enterpriseInfoRO.removeEventListener(ResultEvent.RESULT, enterpriseInfo_Handle);
if (e.result != null)
{
/********** *************/
var tempList:ArrayCollection=e.result as ArrayCollection;
var arr:Array=tempList.toArray();
enterprise_info=[];
for (var a in arr)
{
enterprise_info.push({label: arr[a][1], value: arr[a][0]});
}
enterpriseInfo_CB_ID.selectedIndex=0;
//flag=true;
loadReport();
}
}
//
public function loadReport():void
{
currentState='state1';
inputEStr=enterpriseInfo_CB_ID.text;
if (enterpriseInfo_CB_ID.selectedItem != null)
{
reportRO.getReportInfo(enterpriseInfo_CB_ID.selectedItem.value, time_ID.getTime_flag(), time_ID.getDate());
reportRO.addEventListener(ResultEvent.RESULT, reportInfo_Handle);
}
}
protected function search_keyUpHandler(event:KeyboardEvent):void
{
if(event.keyCode.toString()=='32'||event.keyCode.toString()=='13'||event.keyCode.toString()=='8'){
inputEStr=enterpriseInfo_CB_ID.text;
enterpriseInfoRO.getEnterprisesListByValue(cityInfo_CB_ID.selectedItem.value,StringUtil.trim(inputEStr));
enterpriseInfoRO.addEventListener(ResultEvent.RESULT,_result_enterprise_bySearch);
}
}
private function _result_enterprise_bySearch(e:ResultEvent):void{
enterpriseInfoRO.removeEventListener(ResultEvent.RESULT,_result_enterprise_bySearch);
if(e.result != null){
/********** *************/
var tempList: ArrayCollection = e.result as ArrayCollection;
var arr: Array = tempList.toArray();
var index:int=0;
enterprise_info=[];
for(var a in arr)
{
enterprise_info.push({label:arr[a][0],value:int(arr[a][1])});
index++
}
enterpriseInfo_CB_ID.text=inputEStr;
enterpriseInfo_CB_ID.open();
}
}
public function reportInfo_Handle(e:ResultEvent):void
{
reportRO.removeEventListener(ResultEvent.RESULT, reportInfo_Handle);
report_group_id.removeAllElements();
if (e.result != null)
{
/********** *************/
var tempList:ArrayCollection=e.result as ArrayCollection;
var arr:Array=tempList.toArray();
for (var a in arr)
{
var vGroup:VGroup=new VGroup();
var image:Image=new Image();
image.source=(String(arr[a][3]) == "0" ? "assets/png/report.png" : "assets/png/report2.png");
image.name=String(arr[a][2]);
image.useHandCursor="false";
image.buttonMode="true";
image.mouseChildren="false";
image.addEventListener(MouseEvent.CLICK, reportDetail);
vGroup.addElement(image);
var hGroup:HGroup=new HGroup();
var label:Label=new Label();
label.text=" " + arr[a][1];
var cb:CheckBox=new CheckBox();
cb.label=" ";
cb.selected=(String(arr[a][3]) == "0" ? false : true);
cb.id=String(arr[a][0])+"##"+String(arr[a][2]);
cb.addEventListener(Event.CHANGE,cb_change);
hGroup.addElement(label);
hGroup.addElement(cb);
vGroup.addElement(hGroup);
report_group_id.addElement(vGroup);
}
enterpriseInfo_CB_ID.text=inputEStr;
}
}
]]>
</fx:Script>
<s:BorderContainer width="100%"
..............
<mx:FormItem label=" :"
indicatorGap="0">
<mx:ComboBox id="enterpriseInfo_CB_ID"
dataProvider="{enterprise_info}"
selectedIndex="0"
editable="true"
minWidth="100"
change="loadReport()"
keyUp="search_keyUpHandler(event)"
width="200"/>
</mx:FormItem>
..............
</s:BorderContainer>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Access Request, Session and Application in Struts2If we want to use request, Session and application in JSP, what should we do? We can obtain Map type objects such as Req...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.