Search code examples
javascripthtmlcomboboxdynamic-loadingwebix

How to load combo options on a control click (not initially)?


I am seeking a way to implement the scenario where ui.combo (Webix control) options can be loaded/reloaded from the server only when the user clicks it. Basically, I'm able only to load them initially as follows:

{
   view: "combo",
   options: "myurl.php"
}

But is there a way to detect the click on a control and load/reload the options?


Solution

  • If you want to load options based on the combo item click, then there are 2 methods possible.

    1. Define Options

    You define the options as:

    $$("mycombo").define("options", "newoptions.php");
    

    2. Load Options

    The load can be performed as:

    var list = $$("mycombo").getPopup().getList();
    list.clearAll();
    list.load("newoptions.php");