Threaded View

  1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    51
    Vote Rating
    2
    ExTriqui is on a distinguished road

      1  

    Default MultiGrouping and MultiGroupingSummary

    MultiGrouping and MultiGroupingSummary


    Hi.
    I have an implementation of the Grouping and GroupingSummary extensions with support for multiple groupers.
    All the files needed are attached.
    The code has been kept as unmodified as possible compared to the original features.
    The files attached are.

    ext-patch-4.1.js
    • A patch for the Store.aggregate function that executes the aggregation function for every group level.
    • A couple of patches for AbstractSummary as explained in this post: http://www.sencha.com/forum/showthre...fixes&p=836776
    • An improvement for Summary to allow showing the summary above or below the grid content.
    • A patch to avoid that the Summary feature interferes with the MultiGrouping feature. Using {%this.recursive = true%}{[this.recurse(values)]} in the MultiGrouping template allows this patch to detect recursive calls and not modify them.
    • A patch for Summary to stop using different parameters for summaryRenderer and use the same that are used in the standard renderer function. It will now call summaryRenderer or renderer if summaryRenderer is not set and summaryType is not false.
    • A patch for Summary to store the total values using the column dataIndex instead of the column id.
    MultiGrouping.js and MultiGrouping.css
    Works exactly the same as Grouping but supports multiple groups in the store.
    A new pair of events are fired at the view: enablegrouping and disablegrouping.
    A couple of bugs have been fixed:
    startCollapsed didn't work quite well.
    groupchange events were not fired properly.
    some html markup that was not needed has been removed.
    Known issues: Modifications of the store are not fully supported: the new events onAdd, onUpdate and onRemove have not been modified to work with multiple groups. I still have to work on those, but for not modifiable stores it's not needed (that's why it's not done yet) .

    MultiGroupingSummary.js
    A new method printGroupSummary has been added to avoid conflicts with the Summary feature, so both can work together, MultiGroupingSummary will print summaries for groups and Summary should print the summary for the whole grid.
    It can be modified but the default behavior is to show the calculated totals for every group in its header row, instead of adding a new one.
    It can be modified but if the last level of grouping has only one child row, that row is removed and the group is made not expandable (the data of the child is still shown in the group summary so the child is removed to avoid having two row with the exact same information).
    It uses the same modifications added to the Summary feature to use the same type functions for renderer and summaryRenderer and to save the data using the dataIndex instead of the column id.


    I think that's all I hope you find it useful.
    Of course any bugs you find or improvements, please report them so I can fix them.


    Update 2012/09/21: New you can set startCollapsed with the depth level.
    startCollapsed: true is equivalent to startCollapsed: 0
    startCollapsed: 1 will expand the first level and collapse everything else.
    Attached Files
    Last edited by ExTriqui; 21 Sep 2012 at 2:54 AM. Reason: Fixed a bug with icons