0

Problem using combobox auto-dropdown, when item label has more space in-between words.

asked 2009-10-16 08:13:07 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

updated 2009-10-16 09:43:53 +0800

When a combobox has more spaces in-between two words in an item label, then it trims it to a single space and sets in the combobox, when we navigate and press enter in the auto dropdown list of that particular item. But, when we type in the combobox, then it list properly considering the spaces appropriately.

Consider this item "ABC BUTTER SCHOOL PACK", which contains two spaces in-between ABC and BUTTER. When you type ABC and double space, then it lists the correct item as suggestion in auto dropdown list. But, without typing, if you navigate to that item in dropdown by pressing down arrow key, and select that item. Then it will be set as "ABC BUTTER SCHOOL PACK", where now ABC and BUTTER words are separated by a single space and not by a double space as expected.

Test code:

<?page title="Combo box with auto drop down" contentType="text/html;charset=UTF-8"?>
<zk>
	<window title="Combo box with auto drop down" border="normal">
		Auto-complete Combobox:
		<combobox id="combo" autodrop="true" buttonVisible="false"
			onChanging='result.text = self.getText()' />
		<zscript>
	String[] _dict = { "ABC  BUTTER SCHOOL PACK", "1 LIT SACHET SAGAR GHEE", "abacus", "accuracy",
			"acuity", "bird", "bingle", "blog", "cabane", "cape", "cease", "yea", "yellow", "zebra", "zk", };
	ListModel dictModel = new SimpleListModel(_dict);
	combo.setModel(dictModel);
</zscript>
	</window>
</zk>

I have reported a bug here.

Any suggestion to avoid this problem?

Thanks.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-10-19 01:04:37 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

updated 2009-10-19 01:10:46 +0800

hI,baskaraninfo
you can try "ABC \tBUTTER SCHOOL PACK"
it will double space

//jimmy

link publish delete flag offensive edit

answered 2009-10-20 05:04:30 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Thank you, as1225.

Your suggestion also returns a single space omitting the TAB space, when we select from the drop-down list.

Presently I have been replacing all the double-space into single-space before loading into the combobox to avoid this problem.

Thanks.

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-10-16 08:13:07 +0800

Seen: 533 times

Last updated: Oct 20 '09

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