Solved

Custom Sorting of String

Posted on 2013-11-04
5
635 Views
Last Modified: 2013-11-07
I'm new to Visual Studio and C# but i am using Devexpress 13.1 to create my Pivotgrid. My column header currently display items by alphabetical Sizes. Example: Current column header displays '3X-Large','Large','Medium','Small','X-Large',X-Small','XX-Large'.

I'm looking to display my column header by 'X-Small','Small','Medium','Large','X-Large','XX-Large','3X-Large'. I found some stuff on doing array sorts but i'm having trouble doing this string sort. I'm currently using C# in my project. Any suggestions?
0
Comment
Question by:Southern_Gentleman
  • 2
  • 2
5 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 39624113
@Southern_Gentleman

Is there another column that reflects the actual size of the items as a numeric value?  You might leave that column hidden (zero width) for the UI and only use it for sorting or filtering purposes.
0
 

Author Comment

by:Southern_Gentleman
ID: 39625615
Thanks Aikimark, I tried your method with the numeric value and tried to hide it but it won't allow me to set the column width to zero. When I hide the column of numeric values, the columns reset to automatically sort it alphabetically by the text string of sizes. I liked your idea but it kind of looks like we may need to do it by c# code.
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 39625624
according to this Devexpress, this is how to 'hide' a column in their pivotgrid:

using System;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;

namespace XtraPivotGrid_ExampleTemplate {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e) {
            nwindDataSetTableAdapters.ProductReportsTableAdapter adapter =
                new nwindDataSetTableAdapters.ProductReportsTableAdapter();
            pivotGridControl1.DataSource = adapter.GetData();
            pivotGridControl1.BestFit();
        }
        private void pivotGridControl1_CustomFieldValueCells(object sender, 
            PivotCustomFieldValueCellsEventArgs e) {
            if (pivotGridControl1.Fields.GetVisibleFieldCount(PivotArea.ColumnArea) == 0
                && ceHideColumnGrandTotal.Checked)
                e.Remove(e.GetCell(true, 0));
        }
        private void ceHideColumnGrandTotal_CheckedChanged(object sender, EventArgs e) {
            pivotGridControl1.RefreshData();
        }
    }
}

Open in new window

code example source:
http://www.devexpress.com/Support/Center/Example/Details/E2683
0
 

Author Closing Comment

by:Southern_Gentleman
ID: 39631234
Thanks again.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now