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

Fix dynamic header heights #2800

Merged
merged 1 commit into from
Feb 18, 2015
Merged

Fix dynamic header heights #2800

merged 1 commit into from
Feb 18, 2015

Conversation

c0bra
Copy link
Contributor

@c0bra c0bra commented Feb 18, 2015

Previously header cell heights were calculated based on a "max height is
king" algorithm where cells could grow to match the largest height, but
could never shrink, e.g. this let cells with no filter box be the same
height as those with no filter box.

This presented a problem with toggling features like filtering. If
suddenly no columns were filterable this would leave a big empty space at
the bottom of each header cell.

This change makes header cells display-type "table-cell", which lets them
render like a TD with full height, and places them in table-row and
table divs. Replacing "width" with "min-width" and "max-width" forces the
header cells to be the correct width.

Also the columnStyle method has been replaced with a
columnWrapperStyle method.

Previously header cell heights were calculated based on a "max height is
king" algorithm where cells could grow to match the largest height, but
could never shrink, e.g. this let cells with no filter box be the same
height as those with no filter box.

This presented a problem with toggling features like filtering. If
suddenly no columns were filterable this would leave a big empty space at
the bottom of each header cell.

This change makes header cells display-type "table-cell", which lets them
render like a TD with full height, and places them in table-row and
table divs. Replacing "width" with "min-width" and "max-width" forces the
header cells to be the correct width.

Also the `columnStyle` method has been replaced with a
`columnWrapperStyle` method.
@c0bra c0bra force-pushed the fix-dynamic-header-heights branch from 7a90a4a to 893bb13 Compare February 18, 2015 18:01
c0bra added a commit that referenced this pull request Feb 18, 2015
@c0bra c0bra merged commit e7bd6f2 into master Feb 18, 2015
@c0bra c0bra removed the in progress label Feb 18, 2015
@lecoleco
Copy link

Hi, I'm set enableRowHeaderSelection:true and makin filter dynamic with ng-select. (ui grid last version)

For make that, the only way i found is remove the column without the filter and add the column again now with the filter.

If the option enableRowHeaderSelection is true, the header heights not working good,
show the filter when add and hide the input filter when remove but not change height any more.

I change this point to get the lowest and work's good.
I have another way to show and hide the filter, please tell me.
Thanks

             if (container.headerHeight < maxHeaderHeight) {
                container.explicitHeaderHeight = container.headerHeight;
           }
            if (container.headerCanvasHeight < maxHeaderCanvasHeight) {
                  container.explicitHeaderCanvasHeight = container.headerCanvasHeight;
            }

@cgoss
Copy link

cgoss commented Dec 27, 2016

I believe this may have caused a bug.

I have just started to work with this control and I am at 101 in the tutorial and I get a header row that is the entire size of the viewport with a row the size of the horizontal scroll bar.

This code renderContainer.explicitHeaderCanvasHeight is undefined and the inherited height is that of the parent container element.

if (renderContainer.explicitHeaderCanvasHeight) {
ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: ' + renderContainer.explicitHeaderCanvasHeight + 'px; }';
}
else {
ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: inherit; }';
}

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

Successfully merging this pull request may close these issues.

3 participants