原創|其它|編輯:郝浩|2012-10-30 13:32:35.000|閱讀 1172 次
概述:數據篩選是我們常用的功能,本文通過一個具體的事例為大家展示DevExpress XtraPivotGrid是如何實現對特定字段進行數據篩選的。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
數據篩選是我們常用的功能,本文通過一個具體的事例為大家展示DevExpress 是如何實現對特定字段進行數據篩選的。
下面的事例,目的是篩選出Country字段中含有 Brazil 或USA的數據,代碼如下:
C#
using DevExpress.XtraPivotGrid; PivotGridField field = pivotGridControl1.Fields["Country"]; // Lock the control to prevent excessive updates when multiple properties are modified. pivotGridControl1.BeginUpdate(); try { // Clear the filter value collection and add two items to it. field.FilterValues.Clear(); field.FilterValues.Add("Brazil"); field.FilterValues.Add("USA"); // Specify that the control should only display the records // which contain the specified values in the Country field. field.FilterValues.FilterType = DevExpress.Data.PivotGrid.PivotFilterType.Included; } finally { // Unlock the control. pivotGridControl1.EndUpdate(); }
VB
Imports DevExpress.XtraPivotGrid Dim field As PivotGridField = PivotGridControl1.Fields("Country") ' Lock the control to prevent excessive updates when multiple properties are modified. PivotGridControl1.BeginUpdate() Try ' Clear the filter value collection and add two items to it. field.FilterValues.Clear() field.FilterValues.Add("Brazil") field.FilterValues.Add("USA") ' Specify that the control should only display the records ' which contain the specified values in the Country field. field.FilterValues.FilterType = DevExpress.Data.PivotGrid.PivotFilterType.Included Finally ' Unlock the control. PivotGridControl1.EndUpdate() End Try
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網