Skip to content

Delete Bands from UltraGrid

New Discussion
Nat
Nat asked on Sep 3, 2015 7:25 PM

I would like to be able to remove bands completely from an UltraGrid, not hide them, but remove (delete) them. I would like to do this to prevent weird databinding issues with entity framework either during design time or run time.

Is this possible?

Sign In to post a reply

Replies

  • 0
    Dimitar
    Dimitar answered on Sep 3, 2015 9:01 AM

    Hi,

     

    Thank you for posting in our forums.

     

    You can’t modify the UltraGrid Band’s collection. It is design to mimic the underlying data source, so you cannot delete bands or add new ones. If you can elaborate on the issues you are facing I can try and see if there are other alternatives to solving them, but modifying the bands collection is not possible.

     

    I am looking forward to hearing from you.

    • 0
      Nat
      Nat answered on Sep 3, 2015 3:55 PM

      The issue is that I have a complicated data structure built on Entity Framework with relationships throughout the object structure.

      I am using lazy loading as well so as soon as a navigation property is referenced then the data is loaded. In this case unnecessarily so. (or so it seems looking at the way the UltraGrid currently handles these properties).

      When I load the data into the form I do not want 7 extra bands of data added due to this. I could modify my object structure or create derived classes specifically for the interface sothe grid shows/loads only what I want. It sort of defeats the purpose of the architecture of my project as it sits as usually I only one 1 or 2 of the bands on the grid. My opinion is the same of the extra columns which do not need to be there, I know they can be hidden but sometimes that data does not need to be bound at all and would be handled lower in the data structure but public for other reasons, not bound (hidden or not) on the interface where it could potentially cause other issues that need workarounds.

      Hopefully that makes sense.

      Looking for recommendations here at this point.

      • 0
        Mike Saltzman
        Mike Saltzman answered on Sep 3, 2015 5:40 PM

        Hi Nat,

        The grid will create bands and columns based on the data source you assign it. There's really no way around that. You can hide the columns or bands. And you might be able to prevent the grid from loading bands past a certain depth by setting the MaxBandDepth property. But that won't help in this case if your bands are siblings or the ones you want to remove aren't necessarily the deepest.

        There are some alternatives:

        1) You could use an intermediary data source. In other words, some object that binds to the grid and has the data structure you want and acts as an intermeddiary between the grid and the "real" data source. The UltraDataSource can be used for this purpose and you could set it up to load data from your real data source on-demand. The UltraDataSource fires events to let you know it needs data or that data has been changed and then you have to write some code to provide the data or write it back to the "real" data source.

        2) While the UltraGrid does not have the ability to remove a band, the UltraWinTree control does. So you might want to consider using a tree instead of a grid. The tree supports columns and sorting just like the grid. But the down side is that the tree lacks certain grid features like filtering, summaries, and exporting. So obviously this is not a good solution if you need those features.

      • 0
        Nat
        Nat answered on Sep 3, 2015 7:25 PM

        Thank you, I will try the UltraWinTree for cases where I don't need those few features and in the case where those are needed I will put a simpler datasource to only expose wanted data to the UltraGrid.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Nat
Favorites
0
Replies
4
Created On
Sep 03, 2015
Last Post
11 years ago

Suggested Discussions

Tags

Created by

Nat

Created on

Sep 3, 2015 7:25 PM

Last activity on

Sep 3, 2015 7:25 PM