popup -> list -> hide item

Hi, I want to know if there is any chance to do this one:

I have button with defined popup
In popup is list (actions, what can be done with records…)
I have more views/screens where my button is placed…
What I need to do, is to hide some items from popup list -> depending on view/screen or any other user interaction…
e.g. I am not allowed to show him in popup list “delete record” item, when he is already adding record…

I do not want to delete list items, just hide them…
Something like this:
$$(“fastOrdersMenu_list”).item(“todayOrder”).define(“hide”, true);
OR
$$(“fastOrdersMenu_list”).item(“todayOrder”).hide();

Is it possible??

thanks

You can

a) just reload a list of options

$$(“fastOrdersMenu_list”).clearAll();
$$(“fastOrdersMenu_list”).parse(options_for_current_view);

or

b) you can use filter api

$$(“fastOrdersMenu_list”).filter(function(obj){
if (obj.id == todayOrder) return false;
return true;
});

calling filter second time, without parameters, will reset list to the initial set

perfectly … Thank you for your advice