ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

List box checkmark alignment problem?

blin
5 Dec 2011 16:05:55 GMT
5 Dec 2011 16:05:55 GMT

In list box when multiple and checkmark set to true, if a label in list cell has style "float: left;", the checkmark will move to the right side of label. Is this a bug?

The following code can reproduce the problem, see the first checkbox is not aligned with the rest.

<zk>
<window title="listbox demo" border="normal" width="250px">
<listbox id="box" checkmark="true" multiple="true">
<listhead sizable="true">
<listheader label="name" sort="auto" ></listheader>
<listheader label="gender" sort="auto" ></listheader>
</listhead>
<listitem>
<listcell>
<label value = "Mary" style="float: left;"></label>
</listcell>
<listcell label="FEMALE" ></listcell>
</listitem>
<listitem>
<listcell label="John" ></listcell>
<listcell label="MALE" ></listcell>
</listitem>
<listitem>
<listcell label="Jane" ></listcell>
<listcell label="FEMALE" ></listcell>
</listitem>
<listitem>
<listcell label="Henry" ></listcell>
<listcell label="MALE" ></listcell>
</listitem>
</listbox>
</window>
</zk>


Thanks,
Bing

matthewgo
6 Dec 2011 03:27:02 GMT
6 Dec 2011 03:27:02 GMT

Hi
Please try the following code:

<label value = "Mary"  style="float:left; display:inline-block">

BTW, is there any specific reason why you specify float as left? since the default behavior is left.

blin
6 Dec 2011 13:07:12 GMT
6 Dec 2011 13:07:12 GMT

Hi matthewgo,

Thank you for the code. But I tried with adding "display:inline-block" to the style, it's still not working.

The reason I specify float as left for the label is because in order to reused the code, I shared the same style for labels when attached to different parent components, some need this style to default to left.

Bing

matthewgo
7 Dec 2011 01:23:00 GMT
7 Dec 2011 01:23:00 GMT

Hi Bing,
Does the following code meet your need?

<listcell>
    <div style="display:inline-block">
        <label value = "Mary"  style="float:left"></label>
    </div>
</listcell>

blin
7 Dec 2011 14:46:38 GMT
7 Dec 2011 14:46:38 GMT

Hi matthewgo,

Thank you for the code and it worked :-) For my code, I found a workaround.

Thanks again,
Bing