Skip to content

Grouping with frozenBottom:true not working? #81

@marbetschar

Description

@marbetschar

At the bottom of the grid I'd like to add 4 frozen rows which contains the total of the whole grid calculated by using setGrouping on the slick's dataView:

dataView = new Slick.Data.DataView();
_getItemMetadata = dataView.getItemMetadata;
dataView.getItemMetadata = function(row){
    var metadata = _getItemMetadata(row);

    if( row > (dataView.getLength() - 4) ){
        metadata = $.extend(true,metadata,{
            columns:{
                ticker:{
                    colspan:4
                }
            }
        });
}

if(row == (dataView.getLength() - 1)){
    metadata = $.extend(true,metadata,{
        columns:{
            ticker:{
                formatter:function(){
                    return '<strong>Total Vermögen in CHF</strong>';
                }
            }
        }
    });
}

return metadata;
};

dataView.setItems(data);
dataView.setGrouping({
    aggregators:aggregators  //these aggregators are collected dynamically
});

dataView.beginUpdate();
    dataView.addItem($.extend({ id:'titles',ticker:'Total Titel in CHF',groupName:'Total', colspan:3 }, dataView.getGroups()[0].totals.sum ));
    dataView.addItem({ id:'cash',ticker:'Cash in CHF',groupName:'Total', colspan:3 });
dataView.endUpdate();
dataView.setGrouping({
    getter:'groupName',
    formatter:function(g){ return ''; },
    aggregators:aggregators
});

var options = {
    enableColumnReorder: false,
    showHeaderRow: true,
    headerRowHeight: 24,
    frozenBottom: true,
    frozenColumn: 3,
    frozenRow: 4
};

frozenGrid = new Slick.Grid('#grid-kunden-depots', dataView, columns, options);

Which should result in the following

total-correct

But sometimes, the grouping got messed up and the total rows are inside of the grid, not at the bottom:
total-messed-up

Any ideas whats wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions