0

Changing Combobox's Popup position

asked 2011-12-29 11:35:29 +0800

yanushkevicheg gravatar image yanushkevicheg
9

updated 2011-12-29 12:36:28 +0800

Hi, everyone! I'm a new to ZK and I've got a question, perhaps a stupid one.
I'd like to know if I can change the look of my comboboxes . To be more specific, can I modify the popup's shape or position so that it appears, say, above the combobox's button? If it is possible, how can I achieve it?

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-01-12 04:35:56 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

do you mean the ZK popup component or the actual combobox dropdown?

link publish delete flag offensive edit

answered 2012-01-13 09:36:32 +0800

yanushkevicheg gravatar image yanushkevicheg
9

updated 2012-01-13 10:14:00 +0800

I mean actual combobox dropdown. The "pp" abbreviation in z-combobox zclass makes me call it popup all the time.

I found out that the dropdown's position is hardcoded in the web.js.zul.inp.ComboWidget.js file, in method open. Its value is "after_start", and I'd like it to be "overlap_end". Changing the line will work, but this isn't the best way.

At the moment I'm trying to create my one component the way it is described in ZK Component Development Essentials. I extended the org.zkoss.zul.Combobox class to use it as component-class and zul.inp.Combobox widget to use it as a widget class. After the implemention of the molds and the creation of configuration files I tested it and it worked the same way as the original combobox. Which was expected as no modifications were made.

Then I tried to override the open method of the widget class to change the dropdown's position. Here is what I've done:

ui.inp.NewCombobox = zk.$extends(zul.inp.Combobox, {

	open: function (opts) {
		this.$supers('open', arguments);
		this.changePosition();	
	},
	changePosition: function (){
		var pp = this.getPopupNode_(),
		inp = this.getInputNode();
		var $pp = zk(pp);
		$pp.position(inp, "overlap_end");	
	}
});

It supposes to change dropdown's position after calling the original open method. But I'm getting weird results that I cannot explain yet. The combobox's dropdown does change its position and appears the way I want (at the left of the button overlapping the input textfield) but then it disappears and moves back to its original position (which is below the input textfield). What am I missing?

link publish delete flag offensive edit

answered 2012-01-17 12:53:01 +0800

yanushkevicheg gravatar image yanushkevicheg
9

Never mind, I made what I wanted by overriding slideDown_ method. As far as I get, the changes I tried to made were interrupting the animation process of the dropdown's appearing, caused by calling the original open method.

link publish delete flag offensive edit

answered 2014-05-27 08:55:56 +0800

nsharma gravatar image nsharma flag of India
917 1 11

hey i too want to have popup open to the right side of combo button,how should i do?

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: 2011-12-29 11:35:29 +0800

Seen: 330 times

Last updated: May 27 '14

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