combo server load default value

Hi, I am loading data into combo box from the server:


       view: "combo",
       label: 'User',
       options:  'rest->/users/'

and would like to select first value returned by the server. The problem is I don’t know what ID will be returned by REST API, so I would like to hook into selectLoad event which I made up for the purpose of code example below:

       view: "combo",
       label: 'User',
       options:  'rest->/users/',
       on: {
          selectLoad: function(combo, select_data) {
              combo.setValue(select_data.getAt(0).id);
          }
       }

however can’t figure out how to achieve the above looking into:

http://docs.webix.com/api__refs__ui.combo.html

as there is no equivalent of selectLoad event I made up in my code above.

Any suggestions appreciated.

PS.
What is the tag in this forum to post code examples? I use ```` but leading spaces are removed :frowning:

The combo itself doesn’t have such event, but the list inside does have.

{
  view:"combo",
  options:{
      body:{
           url:"rest->/users/",
           ready:function(){
                this.select(this.data.getFirstId());
           }
      }
  }
}

Thank you! … I am just looking into options docs http://docs.webix.com/api__link__ui.combo_options_config.html and can’t find anything about ready method/property - is there anywhere else in the docs I should be looking?

the options can be an array of data or configuration of webix.suggest control

http://docs.webix.com/api__refs__ui.suggest.html

{
  view:"combo",
  options:{
      view:"suggest",
      body:{
           view:"list"
           url:"rest->/users/",
           ready:function(){
                this.select(this.data.getFirstId());
           }
      }
  }
}

so instead of defining just a data we define all widgets - combo, suggest and list in the suggest. It allows to define separate properties for each involved view. And the list component does support ready handler

http://docs.webix.com/api__link__ui.list_ready_config.html