Solved

Custom Sorting of String

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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 article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

776 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