Currently, I am facing an issue with using height: auto
on an angularJS ui-grid. The problem arises from an inline style that specifies a fixed height on the div to which the ui-grid attribute is added. Additionally, the function getViewPortStyle()
dynamically applies height and width to the .ui-grid-viewport class.
Attempts to override the inline style using height: auto !important;
on a class within the element have worked well, except when the window dimensions change due to user interaction, triggering the getViewPortStyle()
function.
I am considering overriding ui-grid to prevent the getViewPortStyle()
function from triggering. While I am open to disabling this function through the ui-grid API, the documentation does not provide guidance on how to achieve this.
Apologies if my question seems scattered. To clarify:
"How can I prevent the getViewPortStyle()
function from triggering or override CSS that dictates the grid's height and width based on browser window size?"
ui-grid getViewPortStyle function
GridRenderContainer.prototype.getViewPortStyle = function () {
var self = this;
var styles = {};
if (self.name === 'body') {
styles['overflow-x'] = self.grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll';
if (!self.grid.isRTL()) {
if (self.grid.hasRightContainerColumns()) {
styles['overflow-y'] = 'hidden';
}
else {
styles['overflow-y'] = self.grid.options.enableVerticalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll';
}
}
else {
if (self.grid.hasLeftContainerColumns()) {
styles['overflow-y'] = 'hidden';
}
else {
styles['overflow-y'] = self.grid.options.enableVerticalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll';
}
}
}
else if (self.name === 'left') {
styles['overflow-x'] = 'hidden';
styles['overflow-y'] = self.grid.isRTL() ? (self.grid.options.enableVerticalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll') : 'hidden';
}
else {
styles['overflow-x'] = 'hidden';
styles['overflow-y'] = !self.grid.isRTL() ? (self.grid.options.enableVerticalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll') : 'hidden';
}
return styles;
};