Ticket DQ43744
Visible to All Users

Keep only groups with count bigger than 1

created 19 years ago

I'm creating custom groups at runtime and I would like to know if there's a way of not grouping some of the rows. I've read the GridView.CustomColumnGroup Event article but I haven't been able to figure it out.
Or maybe would it be possible to loop though a collection of groups when some event is fired and delete those with a count is smaller than 2 ?
Example:
Row 1: Name = George Type = Male
Row 2: Name = Joe Type = Male
Row 3: Name = Sandra Type = Female
If I group my rows with the column "Type", I want George and Joe to be grouped but I don't want Sandra to be grouped. In other words, I don"t want any group of 1.
If you could point me to an approach that would help me on this, it would be greatly appreciated.
Thanks,
Guillaume

Comments (3)
Stan (DevExpress Support) 19 years ago

    Hi Guillaume,
    I'm sorry, but it is impossible. The XtraGrid doesn't allow displaying not grouped rows within the grouped GridView, I'm sorry. However, you can perform grouping in such a way so groups which rows count less than some value will be merged into a single group. I have attached a sample project which demonstrates how to implement this feature. Please review it and inform me whether this approach suits your needs.
    Thanks,
    Stan.

    OV OV
    Olivier Vaillancourt 19 years ago

      Hello Stan,
      That wouldn't be helpful in our case as our particular project needs to keep the order of the rows. My specific need would be to somehow reduce the screen space used by many rows of the same type and at the same time keep some notion of order.
      I thought about using the LookUpEdit to provide a scroll down menu so that I could click on a row "type" and choose between the many names that exists for the same type. However, as every rows have master-details relationships that I had to display when a new row is selected, it proved to be very complex to implement.
      If there's any other features of the grid that I could use to fulfill my need, it would be nice to point that out. It doesn't even matter if I have to do some treatment on my datasource to make it work.
      Thanks again for your help,
      Guillaume

      Stan (DevExpress Support) 19 years ago

        Hi Guillaume,
        >>
        That wouldn't be helpful in our case as our particular project needs to keep the order of the rows.
        <<
        You can preserve the rows sort order by changing the custom sorting mechanism. I have corrected the sample project so it demonstrates how to accomplish this task.
        >>
        I thought about using the LookUpEdit to provide a scroll down menu so that I could click on a row "type" and choose between the many names that exists for the same type. However, as every rows have master-details relationships that I had to display when a new row is selected, it proved to be very complex to implement.
        <<
        I think this approach is not quite right and it will be very difficult to implement this functionality. I should mention that the XtraGrid already provides the filtering feature. You can filter data by selecting any type from the column's filter drop down list. Please review the "Filtering Overview" help topic in the XtraGrid documentation to learn more about it.
        I'm looking forward to hearing from you.
        Thanks,
        Stan.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.