I wish to show/hide options in a context menu
when I use showItem/HideItem the order value in the object gets cleared after the first use and the each operation fails, if I use enableItem/disableItem the function performs as expected.
I also looked at using parse to create new data on the fly for the context menu from json text strings.
This is a snippet of the enable/disable version.
Any help on this would be appreciated.
Regards
Clive
webix.ui({
view:"contextmenu",
id:"context_1",
name:"context_1",
data:[
{id:"link",value:"New Link"},
{id:"family",value:"New Family"},
{id:"person",value:"New Person"}
],
on:{
onItemClick:function(id){
webix.message(this.getItem(id).value);
}
}
});
var context_options='link,family';
$$("tb_new").attachEvent("onItemClick", function (id){
$$("context_1").data.each(function (obj){
var id=obj.id;
if(context_options.search(id)>-1){
$$("context_1").enableItem(id);
}else{
$$("context_1").disableItem(id);
}
});
$$("context_1").show();
});