?
Solved

Custom Sorting of String

Posted on 2013-11-04
5
Medium Priority
?
678 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 46

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 46

Accepted Solution

by:
aikimark earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

741 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