2010-01-20 2 views

답변

5

내 제안은 데이터 제공 업체의 filterFunction 속성을 사용하는 것입니다. 기본적으로 ArrayCollection의 특정 항목이 제외되는지 여부를 결정하는 함수를 데이터 공급자에게 제공 할 수 있습니다 (항목이 제외 된 경우 AdvancedDataGrid에 표시되지 않고 기본적으로 "보이지 않게"됩니다). filterFunction에 대한 문서는 here입니다.

나는 그 때 확인란을 선택하면 필터 기능이 행을 포함/제외시키기 위해 사용하는 데이터 공급자의 개체에 대한 속성을 설정하는 것이 좋습니다. 일부 (매우 거친) 유사 코드는 다음과 같습니다.

private function checkboxClickHandler(event:MouseEvent):void 
{ 
    /* 
     Based on the MouseEvent, determine the row 
     in the data grid you're dealing with 
    */ 

    myDataProvider[someIndex].checkboxFlag = myCheckBox.selected; 
    myDataProvider.refresh(); // calling refresh() re-applies the filter to 
           // account for changes. 
} 

private function myDataProviderFilterFunction(item:Object):Boolean 
{ 
    // assuming we want the item to be filtered if checkboxFlag is true 
    return !item["checkboxFlag"]; 
} 
+0

위대한 작품입니다! 나는 그것이 간단하다는 것을 알고 있지 않다. –

+0

다행이다. 나는 도울 수 있었다! – Dan

관련 문제