add row and column totalling dynamically?

6 posts, 0 answers
  1. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 09 Apr 2013 Link to this post

    Hi everyone

    I am generating a pivot and need to have a row and column total.  This is dynamic, and my output looks like this:
    I am using AutoGenerateColumns="True".

    My output looks like this:
    ZipCode       2012.01   2012.02 ... 2013.01
    06477      1   7      8

    I would like a total across, and full totalling on the bottom.  For now, I am doing it at the datset level, as I dont know what the cols look like.  However, I do know that any column beginning with a number needs to be totalled.

    I tried a number of tricks, but I would like to get this to happen using a dynamic (calc) column and a dynamic footer item for each data column.  I tried a prerender solution, but I dont seem to have any columns available at that time.

    Can anyone help?

    Thanks
  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 12 Apr 2013 Link to this post

    Hi David,

    Could you please try using the RadPivotGrid control (instead of RadGrid) which is designed for such cases and let me know if it covers your requirements?

    Looking forward for your reply.

    Greetings,
    Radoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 13 Apr 2013 Link to this post

    I would love to, which is why I was so excited to see your control.  However, there is no export, which all customers want, always ;)

    I would love to be able to solve this without having to manufacture computed columns and rows.
  5. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 17 Apr 2013 Link to this post

    Hi David,

    Unfortunately the current version of the RadPivotGrid does not have export functionality. The good news is that we have plans for implementing it and at the moment our developers perform research about how to implement it. However since the RadPivotGrid is a very complicated control we cannot commit the exact time when the export functionality will be implemented.

    Greetings,
    Radoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 17 Apr 2013 Link to this post

    ok, but back to the original question, I have seen some examples where the itemcreated is used, or prerender to build these footer totals.

    Ideally, I would like to say "if the column begins with a number, or follows a certain prototype ("####-##") then it gets totalled.  Any sample code around for somewthing like this?  There are some that are close, but rely upon knowing the column names.  Heck, I would even be comfortable specifying a starting sum column.
  7. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 22 Apr 2013 Link to this post

    Hi David,

    Unfortunately the desired functionality is not supported into the RadGrid. Yes, you can handle the PreRender event and iterate over all columns, you can access the cells by their indexes and find the values into them, however you cannot insert rows and columns dynamically, because the RadGrid is a data bound control and it shows the data from the data source. So, in your case you need to modify the data source to which the RadGrid is bound. Then on PreRender event you can apply different styles to the totals and grand total rows/columns. For example you can create an in-memory DataTable which contains calculated totals and grand total rows/column and use it as data source of the RadGrid.

    I hope this helps.

    Greetings,
    Radoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017