How to close calendar panel with click outside?

176 views
Skip to first unread message

Wiedmann Thomas

unread,
Mar 5, 2014, 5:40:57 AM3/5/14
to yui-s...@googlegroups.com
For panel I found Choosing When to Focus and Hide
http://yuilibrary.com/yui/docs/panel/#choosing-when-to-focus-and-hide

How to do hideOn with calendar widget?

Thanks,
Thomas


Marco Asbreuk

unread,
Mar 5, 2014, 5:48:09 AM3/5/14
to yui-s...@googlegroups.com
create your own events and hide the calendar in the subscriber.

F.i:

mycalendar.get('boundingBox').on(
   
'clickoutside',
   
function() {
        mycalendar
.hide();
   
}
);


Marco

Op woensdag 5 maart 2014 11:40:57 UTC+1 schreef Wiedmann Thomas:

Wiedmann Thomas

unread,
Mar 5, 2014, 9:37:40 AM3/5/14
to yui-s...@googlegroups.com
Hi Marco,

thanks, but I don't understand 'boundingBox' ?


mycalendar.get('boundingBox').on(
   
'clickoutside',
   
function() {
        mycalendar
.hide();
   
}
);


Thanks!
Thomas

Marco Asbreuk

unread,
Mar 5, 2014, 9:50:20 AM3/5/14
to yui-s...@googlegroups.com
Calendar is a widget. Every widget has a outermost node (see it as a container-node).
http://yuilibrary.com/yui/docs/widget/#the-bounding-box

This node can be referenced by calling yourwidget.get('boundingBox').

mycalendar.get('boundingBox') will return a node that is actually the 'container' of the calendar.
eventlistener are very often bound to this node (either directly or by delegating)

Marco.


Op woensdag 5 maart 2014 15:37:40 UTC+1 schreef Wiedmann Thomas:

John Lindal

unread,
Mar 5, 2014, 1:38:59 PM3/5/14
to Marco Asbreuk, yui-s...@googlegroups.com
You can also mix in Y.WidgetAutohide.  This has a hideOn attribute that you can configure with events:


Another option, if you just want a calendar and nothing else, is use gallery-popup:


John


--
You received this message because you are subscribed to the Google Groups "yui-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yui-support...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Wiedmann Thomas

unread,
Mar 6, 2014, 7:02:35 AM3/6/14
to yui-s...@googlegroups.com
Hi Marco, hi John

thanks again, but my sample did'nt work (don't close the calendar on clickoutside)
http://jsfiddle.net/thomas_w/rLYsy/

Maybe someone help me out..
Thanks!

Marco Asbreuk

unread,
Mar 6, 2014, 10:41:44 AM3/6/14
to yui-s...@googlegroups.com
clickoutside is provided by the 'event-outside' module: http://yuilibrary.com/yui/docs/api/modules/event-outside.html
you must include this module.

Marco

Op donderdag 6 maart 2014 13:02:35 UTC+1 schreef Wiedmann Thomas:

Wiedmann Thomas

unread,
Mar 7, 2014, 3:25:08 AM3/7/14
to yui-s...@googlegroups.com

Hi Marco,

sorry, but after I have added 'event-outside' the calendar did'nt appears any more... (some error?)

[...]
'datatype-date-math',  
'event-outside',
[...]


I have commented this part. After this, the fiddle run again...
http://jsfiddle.net/thomas_w/rLYsy/9/

Any help again...?

Many thanks,
Thomas

Wiedmann Thomas

unread,
Mar 10, 2014, 8:19:28 AM3/10/14
to yui-s...@googlegroups.com
Looking around, I found this sample ( https://gist.github.com/fabioyamate/5175066 )

And put it here..
http://jsfiddle.net/SBf7H/

Seems to work... now I will rebuild my sample to this one...

Thanks!
Thomas

Wiedmann Thomas

unread,
Mar 11, 2014, 9:52:13 AM3/11/14
to yui-s...@googlegroups.com

At last, I go the easy way and put a close button into my calendar <div> container

http://jsfiddle.net/rLYsy/11/


Marco Asbreuk

unread,
Mar 11, 2014, 9:59:19 AM3/11/14
to yui-s...@googlegroups.com
Hey Thomas,

If it's all about having a datepicker (instead of creating one of your own), you might take a look at http://projects.itsasbreuk.nl/examples/itsadatetimepicker/
This is a date and datetime picker out of the box (using Promises) https://github.com/ItsAsbreuk/itsa-gallery/tree/master/src/gallery-itsadatetimepicker

Best regards,
Marco


Op dinsdag 11 maart 2014 14:52:13 UTC+1 schreef Wiedmann Thomas:

John Lindal

unread,
Mar 11, 2014, 11:27:35 AM3/11/14
to Wiedmann Thomas, yui-s...@googlegroups.com

One of the examples has a popup without a close button.

Joh

On Mar 11, 2014, at 6:52 AM, Wiedmann Thomas <tw...@web.de> wrote:


At last, I go the easy way and put a close button into my calendar <div> container

http://jsfiddle.net/rLYsy/11/



--
You received this message because you are subscribed to the Google Groups "yui-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yui-support...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wiedmann Thomas

unread,
Mar 12, 2014, 8:54:55 AM3/12/14
to
Hi Marko, hi John!

Thanks again. I try to ignore galery modules. Got to many problems with galery (and external libraries) in the past.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages