플렉스에 이상하게 보였습니다. 아마도 잘못된 것을 수행하고 있습니다. 하지만 확실하지 않습니다.플렉스 selectedItem 문제
list.selectedItem을 사용할 때 s : List 또는 s : DropDownList 에 단 하나의 항목 만있는 경우, null로 나타나는 두 가지 경우가 있습니다. requireSelection = "true"를 사용합니다. 이 경우는 아닙니다.
비슷한 다른 사람이 있습니까? 또는 나는 completly 틀리게하고 있냐? 감사 존
편집 : 오픈 편집
------------ 추가 된 코드 방법
를 호출하는 편집 문서를 클릭하면 코드에서 그런 일이 우는 ---- 기본 스파크의 DropDownList로는 표시함으로써 -----------------------나는
<s:TitleWindow width="486" height="300" title="Document Store"
xmlns:tmsbean="services.tmsbean.*"
close="close()">
<fx:Declarations>
<s:CallResponder id="getAllAttachedDocumentsResult"/>
<tmsbean:TMSBean id="tMSBean" showBusyCursor="true"/>
<s:CallResponder id="removeDocumentLinkResult" result="getDocumentList()"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
private static var documentStoreView:DocumentStoreView = null;
[Bindable]
private var attachedToMenomic:String;
public static function getInstance():DocumentStoreView
{
if(documentStoreView == null){
documentStoreView = new DocumentStoreView();
DocumentForm.getInstance().addEventListener(DocumentFormEvent.DOCUMENT_ATTACHED,documentStoreView.getDocumentList);
}
return documentStoreView;
}
public function open(menomic:String,parent:DisplayObject):void
{
attachedToMenomic = menomic;
getDocumentList();
PopUpManager.addPopUp(documentStoreView,parent,true);
PopUpManager.centerPopUp(documentStoreView);
y = y - 80;
}
public function close():void
{
PopUpManager.removePopUp(documentStoreView);
}
private function getDocumentList(evt:DocumentFormEvent = null):void
{
getAllAttachedDocumentsResult.token = tMSBean.getAllAttachedDocuments(attachedToMenomic);
}
private function openEdit():void{
var editDsi:DocumentStoreItem = documentList.selectedItem as DocumentStoreItem;
Alert.show(editDsi.documentName);
DocumentForm.getInstance().openInEditMode(editDsi,this);
}
]]>
</fx:Script>
<s:VGroup left="10" top="10" right="10" bottom="10">
<s:List width="100%" height="100%" id="documentList" itemRenderer="com.documentStore.DocumentItemListRenderer"
dataProvider="{Utilitys.toArrayCollection(getAllAttachedDocumentsResult.token.result)}" />
<s:HGroup horizontalAlign="right" width="100%">
<s:Button label="Attach Document" click="{DocumentForm.getInstance().open(attachedToMenomic,this)}"/>
<s:Button label="Edit Document" click="openEdit()"/>
</s:HGroup>
</s:VGroup>
</s:TitleWindow>
단일 항목이 있고 requireSelection = "true"가 설정된 경우 List.selectedItem이 작동하는 것 같습니다. 아마도 몇 가지 코드를 게시할까요? 어떤 사건 후에 당신은 그 목록을 조사하고 있습니까? –
openEdit 메서드에서 위 코드 (위의 코드를 잘라 내기 위해 몇 비트를 제거한 것)를 첨부했습니다. Signle 항목이 목록에 있거나 (null 포인터의 속성을 수락 할 수없는 경우) 경고에 null 포인터가 throw됩니다. 둘 이상이 있으면 질문없이 데이터가 표시됩니다. – Jon