Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grouping with frozenBottom:true not working? #81

Open
marbetschar opened this issue Nov 3, 2014 · 0 comments
Open

Grouping with frozenBottom:true not working? #81

marbetschar opened this issue Nov 3, 2014 · 0 comments

Comments

@marbetschar
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant