Solved

Custom Sorting of String

Posted on 2013-11-04
5
627 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How do I get the id from URL? 19 48
LINQ question 7 22
Windows Service to Receive TCP Packets 4 43
bulid json format 3 20
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

762 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

20 Experts available now in Live!

Get 1:1 Help Now