1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Russia
    Posts
    10
    Vote Rating
    1
    azesm is on a distinguished road

      1  

    Default MultiGrouping Grid and Summary

    MultiGrouping Grid and Summary


    Hi

    My code MultiGrouping Grid and Summary ( ExtJs 4.0.7 or higher )

    MultiGrouping
    Снимок экрана 2012-09-15.jpg
    MultiGroupingSummary
    Снимок экрана 2012-09-15.jpg

    mg.zip

    Store:
    ...
    groupers: ['field1', 'field2', 'field3', ...]

    Grid:
    features: [{ ftype: 'multigroupingsummarymy' }]
    or
    features: [{ ftype: 'multigrouping' }]

    P.S. rebuild - http://www.sencha.com/forum/showthread.php?226739-MultiGrouping-and-MultiGroupingSummary
    Thank you - ExTriqui

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,982
    Vote Rating
    453
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thank you for the contribution.

    Scott.

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Russia
    Posts
    34
    Vote Rating
    1
    icemanovich is on a distinguished road

      0  

    Default


    guidGenerator() is not defined in this code. Probably this function defined somewhere else.

    Quick fix for this (insert in MultiGrouoping.js):
    Code:
    // Generate unique id for group
        guidGenerator: function(gname){
            var gid = 'x-' + gname + '-' + Ext.id();
            return gid;
        },

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Location
    Russia
    Posts
    10
    Vote Rating
    1
    azesm is on a distinguished road

      0  

    Default


    Hi


    Code guidGenerator()
    Code:
    function guidGenerator() {
        var S4 = function() {
            return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
        };
        return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
    }
    
    



    Code
    trimFIO()
    Code:
    // Removes leading and ending whitespaces
    function trimFIO( value ) {
    
    
        return LTrim(RTrim(value));
        
    }
    
    /// Removes leading whitespacesfunction LTrim( value ) {
        
        var re = /\s*((\S+\s*)*)/;
        return value.replace(re, "$1");
        
    }
    
    
    // Removes ending whitespaces
    function RTrim( value ) {
        
        var re = /((\s*\S+)*)\s*/;
        return value.replace(re, "$1");
        
    }

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Location
    Russia
    Posts
    34
    Vote Rating
    1
    icemanovich is on a distinguished road

      0  

    Default


    Thanks, azesm!
    One more question. There is "group" parameter and it is group.id in MultiGrouping.js
    Code:
    group.id = guidGenerator();
    How can I figure out parent of node on groupcontextmenu event?
    Code:
     
    groupcontextmenu: function(view, node, group, e, eOpts){
    //group - text parens.id
    }
    Example:
    Code:
    mangle:
    FORWARD
    INPUT
    OUTPUT
    When i click to INPUT I need to know parent ("mangle").

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Location
    Russia
    Posts
    10
    Vote Rating
    1
    azesm is on a distinguished road

      0  

    Default


    Hi, icemanovich!

    probably can not answer immediately, you need to experiment
    group.id - I made in order to properly open subgroups, as in the original code, the map was not very nice

  7. #7
    Sencha User
    Join Date
    Jun 2011
    Location
    Russia
    Posts
    34
    Vote Rating
    1
    icemanovich is on a distinguished road

      0  

    Default


    As quick solution I set group.id as composite field:
    Code:
    guidGenerator: function(group){
            var gid = '';
            if (group.records.length){
    
                if (group.records[0].data.table === group.name){
                    gid = group.name;
                } else {
                    gid = group.records[0].data.table + '/' + group.name;
                }
            }
            else {
                gid =  group.name;
            }
            return gid + '-' + Ext.id();
        },
    P.S. azesm, thanks for adaptation for 4.07!

  8. #8
    Sencha User
    Join Date
    Sep 2011
    Location
    Russia
    Posts
    10
    Vote Rating
    1
    azesm is on a distinguished road

      0  

    Default


    icemanovich,
    Here's more to this grid would make the total amount of the line at the bottom. It would be cool at all.

  9. #9
    Sencha User
    Join Date
    Sep 2011
    Location
    Russia
    Posts
    10
    Vote Rating
    1
    azesm is on a distinguished road

      0  

    Default Addition

    Addition


    Hi All!

    Not much altered code and added the ability to include lines with the total amount


    Code:
    features: [
    {
               ftype: 'multigroupingsummarymy',
               totalSummary: 'fixed',          // Can be: 'fixed', true, false. Default: false
               totalSummaryTopLine: true,      // Default: true
               totalSummaryColumnLines: false,        // Default: false          
               startCollapsed: true,
               forceFit: true,
               groupHeaderTpl: '{name} ({rows.length})'
    }],
    I have used code Mcaveti
    "Grouping Summary with Total Row for Ext 4.0.7"
    http://www.sencha.com/forum/showthre...478#post790478
    Attached Files

  10. #10
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
    bbbbkai is on a distinguished road

      0  

    Default How to use multigroupingsummary

    How to use multigroupingsummary


    I don't know how to use multigroupingsummary, Who can give me a demo like this Снимок экрана 2012-09-15.jpg
    Thanks
    Email:bbbbkai@yahoo.com.cn