Page 5 of 5 FirstFirst ... 345
Results 41 to 43 of 43

Thread: Ext.ux.grid.mzPivotGrid

  1. #41
    Sencha User
    Join Date
    Aug 2015
    Posts
    5

    Default showZeroAsBlank pivotgrid excel export

    http://www.mzsolutions.eu/mzPivotGrid-configurator.html also results the same. Seems to be its not fixed yet

  2. #42
    Sencha User
    Join Date
    Aug 2015
    Posts
    5

    Default showZeroAsBlank pivotgrid excel export

    Example url also results the same. Seems to be its not fixed yet

  3. #43
    Sencha Premium User
    Join Date
    Dec 2009
    Location
    Iasi, Romania
    Posts
    159

    Default

    Quote Originally Posted by jayannet View Post
    Example url also results the same. Seems to be its not fixed yet
    You're right. Now I see that you were talking about the excel data. You can use this override to fix this (in case you have one of the latest versions):

    Code:
    Ext.define('overrides.pivot.dataexport.Formatter', {
        override: 'Mz.pivot.dataexport.Formatter',
    
        prepareData: function(){
            var me = this,
                matrix = me.matrix,
                group, columns, headers, record, i, dataIndexes;
    
            if(!me.onlyExpandedNodes){
                me.setColumnsExpanded(matrix.topAxis.getTree(), true);
            }
    
            columns = Ext.clone(matrix.getColumnHeaders());
            headers = me.getColumnHeaders(columns, 0);
            dataIndexes = me.getDataIndexColumns(columns);
    
            if(!me.onlyExpandedNodes){
                me.setColumnsExpanded(matrix.topAxis.getTree());
            }
    
            group = me.extractGroups(matrix.leftAxis.getTree(), dataIndexes);
    
            Ext.apply(group, {
                includeTotals:  me.includeTotals,
                columns:        headers,
                summary:        [],
                summaryText:    matrix.textGrandTotalTpl
    });
    
            record = matrix.preparePivotStoreRecordData({key: matrix.grandTotalKey});
            for(i = 0; i < dataIndexes.length; i++){
                group.summary.push( (Ext.isEmpty(record[dataIndexes[i]]) || (matrix.showZeroAsBlank && record[dataIndexes[i]] === 0) ) ? '' : record[dataIndexes[i]] );
            }
    
            return group;
        },
    
        extractGroups: function(items, columns){
            var matrix = this.matrix,
                group = {},
                i, j, doExtract, item, row, record;
    
            for(i = 0; i < items.length; i++){
                item = items[i];
    
                if(item.record){
                    group.rows = group.rows || [];
    
                    row = [];
                    for(j = 0; j < columns.length; j++){
                        row.push( (Ext.isEmpty(item.record.get(columns[j])) || (matrix.showZeroAsBlank && item.record.get(columns[j]) === 0) ) ? '' : item.record.get(columns[j]) );
                    }
                    group.rows.push(row);
    
                }else if(item.children){
                    group.groups = group.groups || [];
                    row = {};
    
                    doExtract = this.onlyExpandedNodes ? item.expanded : true;
                    if(doExtract){
                        row = this.extractGroups(item.children, columns);
                    }
    
                    Ext.apply(row, {
                        summary:        [],
                        summaryText:    item.getTextTotal(),
                        text:           item.name
    });
    
                    record = matrix.preparePivotStoreRecordData(item);
                    for(j = 0; j < columns.length; j++){
                        row.summary.push( (Ext.isEmpty(record[columns[j]]) || (matrix.showZeroAsBlank && record[columns[j]] === 0) ) ? '' : record[columns[j]] );
                    }
    
                    group.groups.push(row);
                }
    
            }
    
            return group;
        }
    });

Page 5 of 5 FirstFirst ... 345

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •