这不是世界上最性感的东西,我怀疑它的性能,但这可以解决问题:
function flexRowHeight() {
var self = this;
self.grid = null;
self.scope = null;
self.init = function (scope, grid, services) {
self.domUtilityService = services.DomUtilityService;
self.grid = grid;
self.scope = scope;
var adjust = function() {
setTimeout(function(){
var row = $(self.grid.$canvas).find('.ngRow'),
offs;
row.each(function(){
var mh = 0,
s = angular.element(this).scope();
$(this).find('> div').each(function(){
var h = $(this)[0].scrollHeight;
if(h > mh)
mh = h
$(this).css('height','100%');
});
$(this).height(mh)
if(offs)
$(this).css('top',offs + 'px');
offs = $(this).position().top + mh;
self.scope.$apply(function(){
s.rowHeight = mh;
});
});
},1);
}
self.scope.$watch(self.grid.config.data, adjust, true);
}
}
在选项中使用插件执行:
plugins: [new flexRowHeight()]