forked from mleibman/SlickGrid
-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
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
But sometimes, the grouping got messed up and the total rows are inside of the grid, not at the bottom:
Any ideas whats wrong?
Metadata
Metadata
Assignees
Labels
No labels