'ZK Listbox: Horizontal scrollbar not appearing with hflex=min (in other container/Tabbox)

Here's a snap of the problem:

Link to a picture of the problem

Layout works correctly without hflex="min" - but of course then the columns are too narrow. Here is the blowup:

<?xml version="1.0" encoding="UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<zk>
    <style>
    .module-alternative-amount-cell {
        text-align: right;
    }
    .cost-entry-alternative-amount-cell {
        text-align: right;
    }
    </style>
    <window id="thisEditor" width="99%">

        <!-- header label -->
        <vbox>
            <space height="5px" />
            <hbox>
                <space width="5px" />
                <label id="header" value="A header"
                    style="font-weight:bold;font-size:16px;color:#525252" />
            </hbox>
            <space height="5px" />
        </vbox>

        <groupbox mold="3d">
            <caption label="General Information"
                style="font-weight:bold">
            </caption>
            <grid>
                <columns>
                    <column label="" width="20%" valign="top" />
                    <column label="" width="80%" valign="top" />
                </columns>
                <rows>
                    <row style="background: white;border:none">
                        <label value="Name" />
                        <textbox id="nameText" width="350px" ></textbox>
                    </row>

                </rows>
            </grid>
        </groupbox>

        <space height="5px" />

        <groupbox mold="3d">
            <tabbox id="editorTabbox">
                <tabs>
                    <tab label="A" />
                    <tab label="M" />
                </tabs>
                <tabpanels>
                    <tabpanel >

                        <listbox >
                            <listhead sizable="true">
                                <listheader label="Name"
                                    sort="auto(name)" sortDirection="descending" />
                                <listheader label="Description" />
                            </listhead>
                            <listitem >
                                <listcell label="n1" />
                                <listcell label="d1" />
                            </listitem>
                            <listitem >
                                <listcell label="n2" />
                                <listcell label="d2" />
                            </listitem>
                        </listbox>
                    </tabpanel>
                    <tabpanel id="mtp" >
                        <vbox id="modulesTabpanelVbox" spacing="2" width="99%">
                        <listbox >
                            <listhead sizable="true">
                                <listheader label="Name"
                                    sort="auto(name)" sortDirection="descending" hflex="min"/>
                                <listheader label="Description Description Description Description Description Description" hflex="min" />
                                <listheader label="Description Description Description Description Description" hflex="min" />
                                <listheader label="Description" hflex="min"/>
                                <listheader label="Description" hflex="min"/>
                            </listhead>
                            <listitem >
                                <listcell label="n1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                            </listitem>
                            <listitem >
                                <listcell label="n2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                            </listitem>
                        </listbox>
                        <listbox >
                            <listhead sizable="true">
                                <listheader label="Name"
                                    sort="auto(name)" sortDirection="descending" hflex="min"/>
                                <listheader label="Description" hflex="min"/>
                                <listheader label="Description Description Description Description Description" hflex="min"/>
                                <listheader label="Description" hflex="min"/>
                                <listheader label="Description Description Description Description" hflex="min"/>
                            </listhead>
                            <listitem >
                                <listcell label="n1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                            </listitem>
                            <listitem >
                                <listcell label="n2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                            </listitem>
                        </listbox>
                        </vbox>
                    </tabpanel>
                </tabpanels>
            </tabbox>


        </groupbox>
    </window>
</zk>

For the sake of the length of the example I added only a few columns, please make the browser window narrow to see the problem and then reload the page.

(edit: I added sizable=true on the listhead, now you can force a horizontal scrollbar to appear by making the column wider. Furthermore the scrollbar can only be made to appear if there are two tabs.)

Background: I found some questions that might be going in the same direction, but a solution for my problem I didn't find. Beware that I don't want to add 'overflow: auto;" to the tabpanel - that destroys the use Tabpanel for me. In fact I have an outer tabpanel around this code and would have to add the scrollbar there, which makes all tabpanels grow scrollbars... and the scrollbar isn't even on the bottom of the tabpanel's space. Sorry if this is convoluted, if you layed out stuff like this you probably have an idea. Furthermore I don't want fixed sizes of course.

On a sidenote: shrinking the (browser)window is not shrinking the listbox - growing it is no problem. Something's up here!

Thanks!



Solution 1:[1]

This will probably solve your problem, I have added an DIV before VBOX, you can notice it below

<tabpanel id="mtp" >    <--------## your 2nd panel ###
                        <div style="overflow:auto;position:relative">  <--change###
                        <vbox id="modulesTabpanelVbox" spacing="2" width="99%">

                        <listbox >
                            <listhead sizable="true">
                                <listheader label="Name"
                                    sort="auto(name)" sortDirection="descending" hflex="min"/>
                                <listheader label="Description Description Description Description Description Description" hflex="min" />
                                <listheader label="Description Description Description Description Description" hflex="min" />
                                <listheader label="Description" hflex="min"/>
                                <listheader label="Description" hflex="min"/>
                            </listhead>
                            <listitem >
                                <listcell label="n1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                            </listitem>
                            <listitem >
                                <listcell label="n2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                            </listitem>
                        </listbox>
                        <listbox >
                            <listhead sizable="true">
                                <listheader label="Name"
                                    sort="auto(name)" sortDirection="descending" hflex="min"/>
                                <listheader label="Description" hflex="min"/>
                                <listheader label="Description Description Description Description Description" hflex="min"/>
                                <listheader label="Description" hflex="min"/>
                                <listheader label="Description Description Description Description" hflex="min"/>
                            </listhead>
                            <listitem >
                                <listcell label="n1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                                <listcell label="d1" />
                            </listitem>
                            <listitem >
                                <listcell label="n2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                                <listcell label="d2" />
                            </listitem>
                        </listbox>
                        </vbox>
                        </div>    <----- change
                    </tabpanel>

regards, Aman

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1