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
2265
UltraGrid Grouping with Text and Images
posted

I have the following flat table structure in my UltraDataSource which is then bound to my UltraGrid.

Now that view is not really useful to a user.  I want to be able to organise the data such that the user can view Account->Permission assignments either by Account or by Permission.  The Icon is related to the Account - if it is a group or is a user.

I have a combo where the user can select a view.  This dynamically changes the SortedColumns.  I am using OutlookGroupBy to display the hierarchy.  The following code is executed when the user selects a view in the combo:

            ultraGrid1.DisplayLayout.Bands[0].Groups.Clear();
            ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear();
            this.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
 
            string column = ultraCombo1.Value == "By User" ? "AccountName" : "PermissionName";
            var col = ultraGrid1.DisplayLayout.Bands[0].Columns[column];
            var colIcon = ultraGrid1.DisplayLayout.Bands[0].Columns["Icon"];
            //ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("Icon", false, true);
            ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add(column, falsetrue);
            this.ultraGrid1.Rows.ExpandAll(true);

This displays the 2 views as follows:

View By User

View By Permission

            

This all looks ok.  However, I want the icon to be displayed alongside the account at all times.  I also don't want the summary to display the column name - just the value (and maybe the number of items in it).

Is this the way to do the grouping?  Or do I need to create some sort of dynamic multi band layout which would be dependant on the selected view?

I want to add some filtering to the scenario on the account name - so I would have a separate textbox and when the user types characters into it - it filters the accounts listed in the grid.

Thanks

Andez

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Andez,

    Paul Anderson said:
    This all looks ok.  However, I want the icon to be displayed alongside the account at all times. 

    What column is displaying the image? Is that the Account column? If so, then why is it displaying an image and not the text in the normal (ungrouped) view?

    There's no reason why grouping the grid should have changed the Account column, but since I don't know what you are doing to show the images there in the first place, I can't really guess why it's changing. Maybe you are setting a ValueList on that column and it's getting cleared out for some reason.

    Paul Anderson said:
    I also don't want the summary to display the column name - just the value (and maybe the number of items in it).

    Check out the GroupByRowDescriptionMask property.

    Paul Anderson said:
    Is this the way to do the grouping?  Or do I need to create some sort of dynamic multi band layout which would be dependant on the selected view?

    This seems like a perfectly reasonable approach to the two views you want.

    Paul Anderson said:
    I want to add some filtering to the scenario on the account name - so I would have a separate textbox and when the user types characters into it - it filters the accounts listed in the grid.

    The easiest thing to do would be to use AllowRowFilters and FilterUIType to enable the FilterRow. But if you want the filter textbox outside the grid, then you could use the RowFilters collection on the band to add filters to the grid.

Children
No Data