2010-07-12 3 views
4

행 영역에 사용할 수있는 필드가 2 개 있습니다. 그 중 하나는 "ID"이고 다른 하나는 "이름"입니다. 행 영역에 놓으면 ID, okey로 정렬됩니다. 하지만 방금 "이름"필드를 값으로 정렬했습니다.ASPxPivotGrid 정렬

표시하지 않고 ID별로 정렬하려고하지만 아직 해결하지 못했습니다.

Here the documentatio n 그러나 내 문제를 해결할 수있는 것은 분명하지 않습니다.

누구나 해결 방법을 알고 있습니까?

편집 : 예 :

alt text http://community.devexpress.com/forums/214248/PostAttachment.aspx

답변

1
다음

당신을 위해 작동해야 코드 :

private void pivotGridControl1_CustomFieldSort(object sender, DevExpress.XtraPivotGrid.PivotGridCustomFieldSortEventArgs e) { 
    if(e.Field.FieldName == "Name") { 
     int value1 = Convert.ToInt32(e.GetListSourceColumnValue(e.ListSourceRowIndex1, "ID")); 
     int value2 = Convert.ToInt32(e.GetListSourceColumnValue(e.ListSourceRowIndex2, "ID")); 
     e.Result = Comparer.Default.Compare(value1, value2); 
     if(e.SortOrder == DevExpress.XtraPivotGrid.PivotSortOrder.Descending) 
      e.Result = -e.Result; 
     e.Handled = true; 
    } 
} 

가 작동 하는가는?

+0

설명해 주셔서 감사합니다! – GianlucaBobbio