Nathan Leland
Nathan Leland

Reputation: 63

Combobox returns an empty string instead of item with ID=0

I'm facing an issue with the Webix combobox: I have a dataset

{id:0, value:'Banana'},
{id:1, value:'Apple'},
{id:2, value:'Cucumber'},
{id:3, value:'Tomato'} //, etc.

But when I'm trying to set the first value as initial, the actual value stays empty, e.g.

{
   view:"combo", id:'combo',
   options:my_options,
   value:0
}

getValue() returns an empty string, but if ID is not 0 all works well. Anyone knows why this happens?

Here's the snippet http://webix.com/snippet/5d2f09db

Is there a workaround or I've missed something important?

Upvotes: 0

Views: 316

Answers (1)

Munna Extreme
Munna Extreme

Reputation: 390

Seems like the combo value index starts from 1, try the following code.

var combo = webix.ui({
view:"combo",
options:[
{id:"0", value:'Banana'},
{id:1, value:'Apple'},
{id:2, value:'Cucumber'},
{id:3, value:'Tomato'}
],
value:0
});     

console.log(combo.getValue()); 

Upvotes: 1

Related Questions