Dynamic value in richselect

Hello , I have a form with a richselect

var form = {
view: “form”,
id: “dirForm”,
elements:[
{view: “richselect”,
css: “my_list”,
id: “dirType”,
options:{
css: “my_list”,
data: [
{id:“tel1”, value: “

”},
{id:“tel2”, value: “
”}
]
},
]
};

I want to define value between conditions so is it possible to add a function inside data to choose value to define ?

So, if it not possible , I tried to do that after init with methods : hide(), define() but the result is not good.

The closest solution is :
$$(“dirType”).define(“options”,[{id:“tel2”, value: “

”}]);
$$(“dirType”).refresh();

With this solution , I have juste one value in combo but I lost the css of “my_list”.

What is the better solution to define values dynamicly ? any ideas ?

Thanks

Sorry the “value” is gone when I post :wink:

Hello. To define a new value, try to use richselect.getList().add(. . .)

http://docs.webix.com/api__ui.richselect_getlist.html

Snippet: http://webix.com/snippet/c826d566

Hello , I found a solution yesterday :

var form = {
view: “form”,
id: “dirForm”,
elements:[
{view: “richselect”,
css: “my_list”,
id: “dirType”,
options:{
view: “suggest”,
body : {
css: “my_list”,
id: “dirTypeList”,
data: [ ]
},
}
}
] };

$$(“dirTypeList”).clearAll();
var data = new Array();
if(condition){
data.push({id:“toto”, value “tata”});
}
etc…

$$(“dirTypeList”).define(“data”,data);
$$(“dirTypeList”).refresh();

Thanks for the response :wink: