Loj Loj - 2 months ago 12
Javascript Question

How to show ui.combo popup manually?

I'm trying to open a popup of Webix combo control programmatically, but there are three issues I can't overcome.

Here's the snippet that represents them:


  • popup list spreads to the width of the form container (probably the current
    combo.$view
    is the wrong target to open a popup)



Only on initial state (I mean the popup wasn't opened yet by user actions)


  • the initial value is ignored

  • new value can't be selected from the opened popup



Here's the code of the combo and the button:

{
view:"combo",
inputWidth:350,
id:"mycombo",
value:1,
options:list_data
},
{
view:"button",
value:"show popup",
click:function(){
var combo = $$("mycombo");
var list = combo.getList();
list.show( combo.$view ); // probably wrong
}
}


Unfortunately, I can't figure out what I'm doing wrong (or is it possible at all). Thanks in advance.

Loj Loj
Answer

Found it! list.show( combo.$view ) was really troublesome notation. In the following code

var combo = $$("mycombo"); 
var list = combo.getList();
list.show(combo.getInputNode());

show(combo.getInputNode()) resolves two of three problems. Still, I have no idea how to make the visual selection work initially, but for now, it's not a big deal.

Comments