Skip to main content

Summaries at bottom of columns

Comments

3 comments

  • Dapfor Team

    Hello Kelly.

    This feature is very easily accomplished by docked rows. In principle, there are several possible implementations. The first is to create a special data object that has access to a collection of business objects, especially if the collection is IBindingList. For example you have a collection of deals and you need to calculate the total amount of all deals, which is represented by an object called SumDeals. It would be better if this object is realizing INotifyPropertyChanged interface. The property providing the total amount of all deals can have the same name than properties of the Deal class. The object SumDeals is added to the grid once and the Row.Dock is set to RowDockStyle.Bottom. New transactions are added to the collection of deals. In this case, SumDeals produces a simple arithmetic operation and notifies the grid that the value has changed.

    Other way is to add an empty data to the grid and calculate summaries or averages in PaintRow or PaintCell events. You will find an example of this implementation in attachments.

    Some words about the performance: if a summaries/averages row is not visible – there are no calculations because PaintRow/PaintCell is not called.

    Best regards,

    The Dapfor Team

     




    SumRowExample.zip
    SumRow.PNG
    0
  • Ondřej Svoboda

    Hello,

    I need also summaries (on bottom or top), but I would require that they are always visible. For example something like second header, so the user can see the summaries even if he is scrolling down/up. Is there a way how to do it?

    Thank you for responce.

    0
  • Dapfor Team

    Hi,

    If you need non-scrollable summaries at the top hierarchical level, there will be enough to dock appropriate rows to the top. What is about other hierarchical levels – you can draw directly in column captions. We attach an example demonstrating how to do it.



    Best regards,
    The Dapfor Team




    SumRowExample.zip
    summaries2.png
    0

Please sign in to leave a comment.

Powered by Zendesk