Date Widget

Use this board to ask questions or have discussions with other Rich Displays users.
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Date Widget

Post by Paul_Ramcharitar »

Is there a way to show/bring up the calendar in a date widget when a button is clicked?
User avatar
Alex
Profound Logic Staff Member
Posts: 233
Joined: Fri Jan 04, 2008 12:10 pm
First Name: Alex
Last Name: Roytman
Company Name: Profound Logic Software
Contact:

Re: Date Widget

Post 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().
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Date Widget

Post 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).
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Date Widget

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Date Widget

Post by Scott Klement »

Does it work if you use the older method -- getObj("Date1").calimg.click()?
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Date Widget

Post by Paul_Ramcharitar »

Hi, "getObj("Date1").calimg.click()" didn't work either.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Date Widget

Post 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.
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Date Widget

Post 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.
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Date Widget

Post by Paul_Ramcharitar »

I still can't get "pui.showCalendar("Date1")" to work in the mobile client. help
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Date Widget

Post 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?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests