0

Paging listbox with vflex - how to set rows?

asked 2009-09-10 06:52:05 +0800

davout gravatar image davout
1435 3 18

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>


My problem is by default the number of rows set for paging do not take up the full vertical space of the listbox. How can I twig this so that the number of listbox rows is set to fill up the available vertical height?

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2009-09-10 18:52:03 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-09-10 18:58:01 +0800

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());

	}

link publish delete flag offensive edit

answered 2009-09-11 05:37:43 +0800

davout gravatar image davout
1435 3 18

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.

link publish delete flag offensive edit

answered 2009-09-11 07:08:51 +0800

smigol gravatar image smigol flag of Italy
316 2

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

link publish delete flag offensive edit

answered 2009-09-11 18:12:20 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

@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

link publish delete flag offensive edit

answered 2009-09-11 18:27:27 +0800

smigol gravatar image smigol flag of Italy
316 2

updated 2009-09-11 18:28:11 +0800

@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

link publish delete flag offensive edit

answered 2009-09-11 18:55:36 +0800

smigol gravatar image smigol flag of Italy
316 2

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

link publish delete flag offensive edit

answered 2009-09-11 19:35:11 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-09-10 06:52:05 +0800

Seen: 806 times

Last updated: Sep 11 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More