Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
How to sort by number of rows grouped by item? [Español]
posted

Hola tengo un ultrawingrid agrupado en un band por una columan la cual me muestra correctamente,pero quisiera ordenarlo pero no ascendente y descendentemen alfabetico, sino por la cantidad de filas por item agrupado...

alguien sabe como hacerlo
?

  • 5118
    posted

    Hi,

    I do not speak spanish but I ran your text through google translate and it looks like you want to change the order of the group by column display based upon the # of child rows for that group by row.  Correct?

    <http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=Infragistics2.Win.UltraWinGrid.v10.3~Infragistics.Win.UltraWinGrid.UltraGridColumn~GroupByComparer.html>. 

    This help link is the GroupByComparer property of an UltraGridColumn and it shows how to do what I think you want to do (if the translation was correct...)

    For example using the Northwind Orders table as the source for the grid you could do the following:

            private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
            {
                UltraGridColumn countryCol = this.ultraGrid1.DisplayLayout.Bands[0].Columns["ShipCountry"];
                if (countryCol != null)
                    countryCol.GroupByComparer = new MyGroupBySortComparer();
            }

        class MyGroupBySortComparer : IComparer
        {
            public int Compare(object objx, object objy)
            {
                UltraGridGroupByRow x = (UltraGridGroupByRow)objx;
                UltraGridGroupByRow y = (UltraGridGroupByRow)objy;

                return x.Rows.Count.CompareTo(y.Rows.Count);
            }
        }

    You will probably have to run this text through a google translate as well to read what I've written.  Let me know if this is the behavior you were trying to achieve.