Hi,
I have an webix code like below.
var a = [
{id:"movie",value:"Movie Name",type:"string"},
{id:"movieplace", value:"movieplace", type:"string"},
{id:"year", value:"year1", type:"string" }
];
webix.ui({
view:“window”,
id:“moviewin”,
height:300,
width:700,
modal:true,
position:“center”,
head:“Movie data”,
hidden: false,
body:{
view:"form",id:"movieform",width:600, scroll: true,
elements:[{
view: "layout",
cols:[
{
view:"combo",
id:"moviedata",
label:"Fields",
options:a
},
{
view:"text",
label:"Value"
},
]
},
{
cols:[
{view:"button",
label:"Movie Data",
click:function(){
}},
{view:"button",
label:"Reset",
click:function(){
}},
{view:"button",
label:"Cancel",
click:function(){
}},
{view:"button",
label:"Add",
click:function(){
$$("movieform").addView({
view: "layout",
cols:[
{
view:"combo",
name:"co",
label:"Fields",
on:{
onChange: function(id){
let LastC = $$('movieform').elements['co'].getList().getItem(id);
for (var i = 0; i < a.length; i++) {
if(a[i].value == LastC.value){
a.splice(i,1);
}
}}
},
options:a
},
{
view:"text",
label:"Value"
},
{view:"icon", icon:"wxi-trash",click:function(){
let toRemove = this.getParentView();
this.getParentView().getParentView().removeView(toRemove)
}},
]});
}},
]
}
],
}
});
In the above code we have a bug like
initially the drop down and textbox is displayed and i am selcting moviename in the dropdown.
When i click on the add button one more row which has combo and textbox is adding up.
I am selecting year1 as the value from the dropdown and filling the textbox as 2006
now clicking on the add button again one more row is getting added with values like moviename and movieplace as valuesfrom the dropdown .
I will select movieplace as the value and then fill the textbox with some value.
but when i click on the trash icon which belongs to year1 it is getting deleted.
but again if i click on the add button again the row which has combo and textbox is getting added but year1 value is missing from the dropdown.
Please advice what should be done in this case.