bwu_datagrid + Polymer 1 : Grid doesn't grow inside a flexbox

133 Views Asked by At

I'm trying to enclose the datagrid inside of a custom component with three stacked divs, the one in the middle acting as a growing div. The middle div grows but the grid only shows the headers, no viewport, no rows.

<!DOCTYPE html>
<dom-module id="vertical-datagrid">
    <template>
        <style include="bwu-datagrid-default-theme">
            :host {
                -webkit-box-sizing: border-box;
                -moz-box-sizing: border-box;
                box-sizing: border-box;
                background: lightblue;
                margin: 0;
                padding: 0;
                display: flex;
                flex-direction: column;
                flex: 1;
                justify-content: flex-start;
                align-items: stretch;
                align-content: stretch;
                overflow: hidden;
                word-wrap: break-word;
                width: auto;
                height: 100%;
                /*
                height: calc(100% + 15px);
                height: -moz-calc(100% + 15px);
                height: -webkit-calc(100% + 15px);
                */
            }
            #myGrid {
                --bwu-datagrid: {
                    width: auto;
                    height: 100%;
                    opacity: 1;
                    transition: opacity 200ms;

                    background: white;
                    outline: 0;
                    border: 1px solid gray;
                };
            }
            #gridHeaderDiv {
                padding: 0;
                margin: 0;
                width: auto;
                height: 20px;
                background-color: lightgoldenrodyellow;
            }
            #gridDiv {
                width: 100%;
                test-decoration: none;
                overflow: hidden;
                flex: 1 1 auto;
                background-color: lightsalmon;
            }
            #footerDiv {
                background-color: lightpink;
                height: 20px;
                width: 100%;
            }
        </style>
        <div id="gridHeaderDiv">
            Top Header
        </div>
        <div id="gridDiv">
            <bwu-datagrid grid id="myGrid"
             theme="bwu-datagrid-default-theme">
            </bwu-datagrid>
        </div>
        <div id="footerDiv">
            Footer
        </div>
    </template>
</dom-module>
</html>

This is how the grid looks: enter image description here

I also added this for the resize, which works great:

dom.window.onResize.listen((dom.Event e) => grid.resizeCanvas(e));

The only way I've managed to get this working is by removing the "gridDiv" nesting and simply placing the grid in between the header/footer divs.

0

There are 0 best solutions below