Skip to content

Replies

0
Ira
Ira answered on Oct 24, 2017 6:47 PM

Works great

Thanks very much, much appreciated.

0
Ira
Ira answered on Oct 23, 2017 11:57 PM

Thanks for the sample.

Modifying the sample a bit, I see where my problem is likely related to the fact that I am actually sorting on multiple columns.

Say you change the button1 click event in your sample project to this:

    private void button1_Click(object sender, EventArgs e)
        {          
            UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
            band.SortedColumns.Add("Product", false, false);
            band.SortedColumns.Add("Id", false, false);
            band.Columns["Product"].SortIndicator = SortIndicator.None;
            band.Columns["Id"].SortIndicator = SortIndicator.None;
        }

If you now run the test project and click Button1, you will see that the rows are sorted only by the Id column.  But if you comment out the lines that set SortIndicator to SortIndicator.None, the sorting works properly:  sorted first by Product, and then by Id.

Fiddling around a bit, I found that if you reverse the order in which SortIndicator is assigned to SortIndicator.None such that you first set the SortIndicator on the Id column followed by setting SortIndicator on the Product column, clicking Button1 sorts things properly (first by Product, then by Id).

This seems to imply that setting SortIndicator to SortIndicator.None needs to be done in the reverse order in which columns are added to the SortedColumns collection.  But when I tried that in my own project, it didn't seem to make a difference.

Is there something special I need to be doing to properly support sorting on multiple columns in code, such that setting SortIndicator to SortIndicator.None doesn't interfere with the sort?

My project is pretty complicated, but if necessary I could try to put together a simplified version that shows the problem.  Just let me know if this is necessary. 

I'm setting the multi-column sort order in the AfterCellUpdate event, in case that makes a difference.  I'm also sorting on a total of four columns (some in descending order, some in ascending order). 

0
Ira
Ira answered on Oct 21, 2017 11:37 PM

I was wrong about not being able to sort on a hidden column, that was actually just a side-effect of something else.  So please ignore that part of my inquiry.

I just need to find out how to get rid of the column sort indicators when sorting via code.