Example #1
0
 private void targetPivot_CustomFieldSort(object sender, DevExpress.XtraPivotGrid.PivotGridCustomFieldSortEventArgs e)
 {
     if (AllowDragRow && e.Field.Area == PivotArea.RowArea)
     {
         List <object> orderlist = e.Field.Tag as List <object>;
         //Comparer comp = new Comparer;
         if (orderlist == null || orderlist.IndexOf(e.Value1) == -1 || orderlist.IndexOf(e.Value2) == -1)
         {
             //e.Result = Comparer.DefaultInvariant.Compare(e.Value1, e.Value2);
             //e.Handled = true;
             return;
         }
         e.Result  = Comparer.DefaultInvariant.Compare(orderlist.IndexOf(e.Value1), orderlist.IndexOf(e.Value2));
         e.Handled = true;
     }
     if (AllowDragColumn && e.Field.Area == PivotArea.ColumnArea)
     {
         List <object> orderlist = e.Field.Tag as List <object>;
         if (orderlist == null || orderlist.IndexOf(e.Value1) == -1 || orderlist.IndexOf(e.Value2) == -1)
         {
             return;
         }
         e.Result  = Comparer.DefaultInvariant.Compare(orderlist.IndexOf(e.Value1), orderlist.IndexOf(e.Value2));
         e.Handled = true;
     }
 }
Example #2
0
 private void pivotGridControl2_CustomFieldSort(object sender, DevExpress.XtraPivotGrid.PivotGridCustomFieldSortEventArgs e)
 {
     if (e.Field.FieldName == "Order_Status")
     {
         object orderValue1 = e.GetListSourceColumnValue(e.ListSourceRowIndex1, "Order_Status_ID"),
                orderValue2 = e.GetListSourceColumnValue(e.ListSourceRowIndex2, "Order_Status_ID");
         e.Result  = Comparer.Default.Compare(orderValue1, orderValue2);
         e.Handled = true;
     }
 }