-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I'm trying to calculate how many lines fits in a listbox using javascript.
I can obtain the height of the listbox, the height of one line and with these data make the calculation.
My problem is that I can't listen when the listbox is resized. I'm able to know when the browser is resized but sometimes the listbox is resized for other reasons (another component that expands and do the listbox smaller, etc.
Is there a way to know when the height of a listbox has changed??
How does ZK know it?? (because they are recalculating how many lines fits in a listbox everytime the listbox is resized)
Thank you!
Hi Neus,
The only way is to override the client onSize function, when the listbox resize, the onSize function will be call
listbox.setWidgetOverride("onSize", "function () {this.$onSize();zk.log('onSize');}");
Hi
I have one more question here. It is possible to show the empty record lines in the list if there are only fewer records in the list. Say for example
I have fixed height for the list box and from the DB, it shows the records and assume that we have only 3 records. So the remaining space will show as blank. Can
we show empty lines without much code ?
Regards
Senthil M
Hi Senthil,
Do you mean this feature?
http://books.zkoss.org/wiki/ZK_Component_Reference/Data/Listbox#Show_messages_when_empty
No. Look at the picture. It shows only one record and also it shows empty records for better look and feel.
You need to add empty data to the listModel, otherwise listbox/grid only render the data in the model.
Asked: 2012-10-15 11:29:05 +0800
Seen: 125 times
Last updated: Nov 09 '12