Page 1 of 3

Date Widget

Posted: Mon Oct 01, 2012 3:29 pm
by Paul_Ramcharitar
Is there a way to show/bring up the calendar in a date widget when a button is clicked?

Re: Date Widget

Posted: Tue Oct 09, 2012 10:38 pm
by Alex
In the current release, you can attach the following to the button's onclick event:

Code: Select all

getObj("Date1").calimg.click()
Where "Date1" is the id of the date widget.

In the next release, we will publish a more formal API to accomplish this. It will be called pui.showCalendar().

Re: Date Widget

Posted: Mon Nov 12, 2012 4:27 pm
by Paul_Ramcharitar
Hi Alex,

I placed the "pui.showCalendar("DateID")" method in the onClick of a button, with the ID of a date widget as its parameter, but it didn't work. When I click on the button nothing happens.

I'm using the latest release of profoundui (4.1.6).

Re: Date Widget

Posted: Tue Oct 29, 2013 4:35 pm
by Paul_Ramcharitar
Hi could I have some help. I tried: pui.showCalendar("DateID") and it isn't working. I have it in the onclick of a button. when I click the button, nothing happens.

Re: Date Widget

Posted: Tue Oct 29, 2013 4:48 pm
by Scott Klement
Does it work if you use the older method -- getObj("Date1").calimg.click()?

Re: Date Widget

Posted: Tue Oct 29, 2013 4:55 pm
by Paul_Ramcharitar
Hi, "getObj("Date1").calimg.click()" didn't work either.

Re: Date Widget

Posted: Tue Oct 29, 2013 5:17 pm
by Scott Klement
I've noticed that you can work around this problem by changing your onclick to this:

Code: Select all

setTimeout( function() { pui.showCalendar("Date1"); }, 0 );
Does that work for you?

I'm not sure if that's a "good" way to make it work, but it seems to work for me. I will have to check with colleagues and see what they think.

Re: Date Widget

Posted: Wed Oct 30, 2013 8:34 am
by Paul_Ramcharitar
Hi scott, that method is working for me in the browser, but it isn't working in my mobile tablet or phone. I am using the profound ui mobile client.

Re: Date Widget

Posted: Tue Nov 19, 2013 8:50 am
by Paul_Ramcharitar
I still can't get "pui.showCalendar("Date1")" to work in the mobile client. help

Re: Date Widget

Posted: Tue Nov 19, 2013 10:39 am
by Scott Klement
The original problem occurs because of the way the calendar popup works. When the calendar comes up, you can "click away" (click any area outside of the calendar popup) to close it.

The problem is that when you put a button on the screen that opens the calendar, you start by clicking the button. The first thing your click does is open the calendar box, but then the calendar box sees you clicking outside of the popup (because you're in the middle of a "click" event on the button) and immediately closes the popup.

The setTimeout() worked around this problem by adding a slight delay to opening the popup, so that it occurs after the button click is complete.

Not sure why this wouldn't also work in the mobile client, though. You could try preventing the default action for the click to the button and see if that helps?