primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Visible property to calendar

Open chrillewoodz opened this issue 9 years ago • 7 comments

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[x ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Expected behavior Provide an input/method for closing the calendar upon selecting a date.

What is the motivation / use case for changing the behavior? Especially on mobile devices it's horrible UX since the datepicker takes up so much space on the screen. It's hard to close it manually.

chrillewoodz avatar Feb 06 '17 12:02 chrillewoodz

Now the calendar close after the date is selected. I tried and worked here.

Look https://github.com/primefaces/primeng/blob/master/components/calendar/calendar.ts#L463 and https://github.com/primefaces/primeng/blob/master/components/calendar/calendar.ts#L816 and https://github.com/primefaces/primeng/blob/master/components/calendar/calendar.ts#L1163

upmauro avatar Feb 15 '17 13:02 upmauro

And if I want to close the calendar manually? For example, when a resize event succeeds.

Thanks.

VictorDeBlas avatar Apr 03 '17 13:04 VictorDeBlas

How close the calendar manually? When calendar is inside a pop up not close when a date is selected?

alejandrohn avatar Apr 17 '17 15:04 alejandrohn

We can expose overlayVisible

cagataycivici avatar Jun 20 '17 12:06 cagataycivici

You can create a viewchild and set the 'overlayVisible' property manually:

In your template add a template reference variable:

<p-calendar #myCalendar ... 

In your controller access the overlayVisible property:

@ViewChild('myCalendar') datePicker;

hideDatePicker(){
    this.datePicker.overlayVisible = false;
}

timvl avatar Aug 11 '17 14:08 timvl

Did this used to work or was it just not tested with selectionMode="range"? There is a bug where if you use this property to "programmatically hide" the calendar, the overlay stays open and you can't click anything on the page (due to its z-index). See my stackblitz demo: https://vbwilqlo.github.stackblitz.io I will open an issue...

SSTPIERRE2 avatar Mar 11 '19 20:03 SSTPIERRE2

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

mertsincan avatar Nov 09 '22 14:11 mertsincan