2009-07-13 15 views
0

我有饋送數據像這樣的AvancedDataGrid:Flex:AvancedDataGrid ..Group By?

<stat associate="Henry Smith" date="07/08/09" amount="1"/> 
<stat associate="John Doe" date="07/08/09" amount="1"/> 
<stat associate="John Doe" date="07/09/09" amount="2"/> 

我希望它是這樣,當你點擊日期列的日期,聯營和金額欄只顯示日期。我怎樣才能做到這一點?

這裏是我的AvancedDataGrid:

<mx:AdvancedDataGrid 
    id="wideGrid" 
    width="100%" 
    height="100%" 
    styleName="dataGrid" 
    dataProvider="{_statsXMLList}" 
> 
    <mx:columns> 
     <mx:AdvancedDataGridColumn id="wideGridCol1" 
       dataField="@associate" 
       headerText="Name" 
       width="110"/> 
     <mx:AdvancedDataGridColumn id="wideGridCol2" 
       dataField="@amount" 
       headerText="Amount" 
       width="50" /> 
     <mx:AdvancedDataGridColumn id="wideGridCol3" 
       dataField="@date" 
       headerText="Date" 
       width="60" /> 
    </mx:columns> 
</mx:AdvancedDataGrid> 

回答

0

你需要寫一個過濾功能:

filterFunction:Function 
A function that the view will use to eliminate items that do not match the function's criteria. A filterFunction is expected to have the following signature: 

f(item:Object):Boolean 
where the return value is true if the specified item should remain in the view. 

並應用到你的XMLListCollection。該函數應根據存儲在某處的日期值進行過濾。

當用戶單擊一行時,您設置該日期值,然後在您的XMLListCollection上調用刷新。由於您已將集合綁定到數據網格,因此應更新表格。

這是你想要做什麼,或者與分組有什麼特別的?