-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a paging listbox that sits within a border based layout. See...
<borderlayout> <north> ..... ..... </north> <center> <listbox id="experts" vflex="true" mold="paging" pagingPosition="bottom"> <listhead> <listheader label="Surname" /> <listheader label="First name" /> <listheader label="Alias" /> </listhead> </listbox> </center>
I helped me with the onClientInfo() event at my root window that stores the browsers heigt and width in variables.
I got from there the height and then calculate what is over for the listbox when i subtract the search panels, toolbars
and others obove it.
Than i calulate the count of possible visible rows. Problem is when a user changes the fontsize with Strg+ or Strg-
best
Stephan
public void onCreate$window_BranchesList(Event event) throws Exception { /* autowire comps and vars */ doOnCreateCommon(window_BranchesList, event); ... /** * calculate how many rows have been place on desktop. and set it to the * listBox. */ int maxListBoxHeight = (UserWorkspace.getInstance().getCurrentDesktopHeight() - 155); countRows = Math.round(maxListBoxHeight / 17); borderLayout_branchList.setHeight(String.valueOf(maxListBoxHeight) + "px"); ... // set the paging params paging_BranchList.setPageSize(countRows); paging_BranchList.setDetailed(true); ...
from the RootWindow Controller:
/** * Gets the current desktop height and width and <br> * stores it in the UserWorkspace properties. <br> * We use these values for calculating the count of rows in the listboxes. <br> * * @param event * @throws Exception */ public void onClientInfo(ClientInfoEvent event) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Current desktop height :" + event.getDesktopHeight()); logger.debug("Current desktop width :" + event.getDesktopWidth()); } UserWorkspace.getInstance().setCurrentDesktopHeight(event.getDesktopHeight()); UserWorkspace.getInstance().setCurrentDesktopWidth(event.getDesktopWidth()); }
Thanks for the suggestions, but I'm really looking for the listbox to handle this automatically, so a better idea would be to sub class the listbox and add this form of available row calculation. I've posted an enhancement request for this.
Hi,
you try use fixedLayout="true" listbox property!
<borderlayout> <north> ..... ..... </north> <center> <listbox id="experts" vflex="true" mold="paging" pagingPosition="bottom" fixedLayout="true"> <listhead> <listheader label="Surname" /> <listheader label="First name" /> <listheader label="Alias" /> </listhead> </listbox> </center> </borderlayout>
ORAZIO
@davout.
If the zk team can implement your request this would be a great easement for us all.
Hope they do a listbox.getPossibleRowCount() for the paging component :-)
Stephan
@terrytornado
Hi Stephan, I do not understand your request! Forgive me but I do not seem useful to know how many lines can accommodate a listbox with specific vertical size ... plus I think the value obtained by a prospective properties listbox.getPossibleRowCount is not real because a row may contain a column of type text very large! I hope I explained myself well!
ORAZIO
To complete my opinion, I believe that at this time is more appropriate, given fixed space (the container that hosts the listbox) and set a certain number of lines per page, the listbox is automatically sized and correctly by showing correctly scollbar vertical and the arrows and the shift from one line and another works well! problems that I have already highlighted in some thread:
- http://www.zkoss.org/forum/index.zul#path%3DlistComment%3BdiscussionId%3D9580%3BcategoryId%3D14%3B
- http://www.zkoss.org/forum/index.zul#path%3DlistComment%3BdiscussionId%3D9496%3BcategoryId%3D14%3B
regards
ORAZIO
Yes, i know what you mean.
For us it's the kick if there are no space between the listbox and the component under it without scrollbars.
Where the listbox has fixed rows for the paging. So we calculate the space we have for the listbox
and calculate how many lines can in there. :-)
Yes, i saw you threads. Do you mean with arrow keys the keybord keys ( -> <- should be up and down)?
regards
Stephan
Asked: 2009-09-10 06:52:05 +0800
Seen: 806 times
Last updated: Sep 11 '09