Datepicker hide view

I have a multiview, and in one of the views I have a datepicker
I have configured the back key to go to the previous view of the multiview.

My problem is: when I am in the datepicker view, I open the calendar, and press back key, I go to previous view, but the datepicker dont close

How can I close this? $$(“datepicker”).hide() hides the field, but I only want to close the calendar popup

Thanks

You can use the next:

var popupid = $$("datepicker").popup; $$(popupid).hide();

I get “Cannot call method ‘hide’ of null”

Is the right way? I am unable to do it, with the popup shown or hidden

There was a typo in Stanislav’s answer. Please try:

var popupid = $$(“datepicker”).config.popup;
$$(popupid).hide();