Nested Data with combo box and data table

How can I specify the options for combo in datatable from data?

http://webix.com/snippet/5d43293d

Such functionality is not supported. If you need to have different options in an editor for each row, you can use onAfterEditStart event

http://webix.com/snippet/7474e795

Thanks for the reply Maksim.
But, I have a couple of problems,

  1. How do I tell the combo editor to use ‘name’ instead of ‘value’ in options.
  2. If, a value is selected in the combo, the selected option doesn’t appear.
    In the snippet you shared, the ID of the selected option is being displayed instead of the value.

http://webix.com/snippet/9fd918c8

Please check the updated snippet

(1) - you can use suggest.body.template property to define which data show in options list

(2) - you can use a bit more complex template to fetch the necessary data

Sorry, here is the missed lint to the snippet - http://webix.com/snippet/4d73c3b3

Thank you very much.
It works perfectly :slight_smile:

With what version is supported?

Snippet uses webix 3.4. The API behind the snippet must work with any 3.x build ( as far as I can see )

How can I pre-select an option in activeContent Combo in datatable.

http://webix.com/snippet/376651eb

@jyothsna Please check the snippet: http://webix.com/snippet/be0d760c

As the initial value is stored in the dataset, more convenient way is to use the corresponding column. But options reload every time you open the editor, so the option should be pre-selected in onAfterEditStart event.

@Listopad

Please check http://webix.com/snippet/984f0e85
The selected value is not available directly but, in an Object.
Can you help me populate the pre-selected value?

Also, is there any other simple way,

  1. To sync a combo box with backbone collection, instead of the nested structure which I had followed?
  2. To pre-select a value in combo in a particular column in datatable after it is rendered?

And,

I have observed that, in webix with backbone integration,
I get a script error when I sync a webix component with plain array of objects,
and the error doesn’t show up when its synced with a backbone collection.
Is this expected? If so, may I know the reason?

(1) Yep, if you are sharing a single collection of options for ALL rows, you can sync the single data collection for all rows in the same column. If you have different options list for different rows - it will not work.

(2) Again, it is much more easy to implement if you have a similar set of options for all rows in column. If you have different sets you need to write your own template function

check http://webix.com/snippet/d734fd87

@maksim thank you:)

I have following JSON list and I am not able to add JSON list data to combo options.
I used data webix table but not working.

{
id: “Assignee”, label: “TRIPATHI”, header: “Assignee”, fillspace: true, width: 180, sort: “text”, editor: “combo”,
options: this.auditorslists, suggest: {
template: ‘#value#’,
filter: function (item, value) {
if (item.value.toString().toLowerCase().indexOf(value.toLowerCase()) === 0)
return true;
return false;
},
body: {
template: ‘#value#’,
yCount: 7,
on: {
‘onItemClick’: function (id) {
console.log(“Webix datatable called”);
}
}
}
}
}


JSON List data

[{
“USER_ID”: 103,
“USER_NAME”: “MOHIT”
}, {
“USER_ID”: 104,
“USER_NAME”: “KUMAR”
}, {
“USER_ID”: 105,
“USER_NAME”: “TRIPATHI”
}]

Please check the next snippet

http://webix.com/snippet/181673c4