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
785
Grouping Key when using dynamically created data
posted

Hi - When I bind a dynamically created column and use the IGGridViewDataSourceHelper.GroupKey together the grid no longer generates properly.

I've attached a sample project.

How do I use both dynamically created data and be able to group on a particular column?

SimpleGrid.zip
  • 40030
    Verified Answer
    Offline posted

    Hi, 

    That's b/c the grouping can't resolve. Setting the value to "Motion" tells the data source to look for a property called Motion on your data object. However your data object doesn't even expose any properties. 

    The easiest solution for you would simply to be to add a grouping property to your cSimpleGrid object:

    [Export("group")]
            public string Group
            {
                get 
                {
                    return this["Motion"].ToString();
                }
            }

    Then you would set the grouping key to be "group"

    dsh.GroupingKey = "group";

    It's very important that you export that property. And also to use whatever value you use for the export as the GroupingKey. 

    It's worth noting, that while i hardCoded "Motion" into the data object, you wouldn't necessarily have to do that. The grouping key could be a value you pass into the ctor of cSimpleGrid so that it could be more by dynamic. 

    Hope this helps. 

    -SteveZ