Ticket #3945 (closed bug: fixed)

Opened 5 years ago

Last modified 8 months ago

DatePicker does not respond to any click events in AIR, Google Sites, Windows Metro

Reported by: canthonyza Owned by:
Priority: major Milestone: 1.8.22
Component: ui.datepicker Version: 1.6rc5
Keywords: Cc:
Blocking: Blocked by:

Description

The DatePicker renders perfectly with Themeroller also disappears when out of focus, but seems like none of the click events are being fired. Can't move to next or previous month/year.

Please let me know if there is any other info I can give you.

Attachments

index.html Download (661 bytes) - added by hackfrag 5 years ago.

Change History

comment:1 Changed 5 years ago by scott.gonzalez

  • Priority changed from minor to blocker
  • Milestone changed from TBD to 1.next

We're going to aim for full AIR support in 1.7.

Changed 5 years ago by hackfrag

comment:2 Changed 5 years ago by hackfrag

i got the exactly same problem. I attached my stripped 'index.html' of my AIR app.

comment:3 Changed 5 years ago by hackfrag

Any news about this bug yet? 1.next = 1.9 or 1.8? Thanks! :)

comment:4 Changed 5 years ago by sosensible

Same here... doesn't work in AIR yet. (Not as of 1.7) Will this be working in 1.7.1?

comment:5 Changed 5 years ago by joern.zaefferer

Most likeley related to this security restriction of the AIR sandbox:

Supports dynamically loading strings as code after the load event: eval() function, setTimeout('string', milis), javascript: URLs, attribute handlers on elements such as onclick='myClick()') that are inserted via innnerHTML, and so on.

See  http://help.adobe.com/en_US/AIR/1.5/air_html_security/WS5b3ccc516d4fbf351e63e3d11c0f598320-7ffc.html

comment:6 Changed 5 years ago by ckng

I thought 1.7 suppose to have full Air support? Still not working in 1.7.1.

comment:7 Changed 4 years ago by calum.moore

Hi

For some strange reason Adobe AIR refuses to accept dynamically created onclick="" attributes. For example div.innerHTML='<a onclick="[javascript code]"> ' would not work.

You have to dynamically add the click's back in. You have two options.

Option 1: You can change the ui.datepicker.js file by putting:

AFTER THIS CODE (around line 620):

if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
			$(inst.input[0]).focus();

PUT THIS CODE

id = "#"+$(inst).attr("id");

		$(".ui-datepicker-next").click(function() {
			DP_jQuery.datepicker._adjustDate(id, +1, 'M');
		});	
		
		$(".ui-datepicker-prev").click(function() {
			DP_jQuery.datepicker._adjustDate(id, -1, 'M');
		});	
		drawMonth = inst.drawMonth;
		drawYear = inst.drawYear;
		$(".ui-datepicker-calendar").find("tr > td").each(function() {
			$(this).click(function() {
				DP_jQuery.datepicker._selectDay(id,drawMonth,drawYear, this);
			});
		});

Option Two: Adjust the above code around the onChangeMonthYear event. I'll let you figure it out.

comment:8 Changed 4 years ago by snover

Patch for jQuery UI 1.8:  http://zetafleet.com/dev/jui/jquery.ui.datepicker.js.air-fix.patch

This patch is fully tested.

comment:10 Changed 4 years ago by ankur

I am unable to verify this fix with latest rev 1.8 sources.

Built a bare-bones AIR app (using Aptana studio) with jquery-1.4.2.min.js and jquery-ui-1.8.min.js. Used the default demo code from JQuery website -

<script type="text/javascript">
	$(function() {
		$("#datepicker").datepicker();
	});
	</script>
<p>Date: <input type="text" id="datepicker"></p>

The datepicker shows up on the input box but does not allow for selection of any date from the drop-down, the prev and next buttons do not work either. Tried listening to onSelect event for this datepicker and noticed that it never gets fired. Am i missing something?

comment:11 Changed 4 years ago by snover

The patch was not merged back into the trunk for whatever reason, so yeah, if you use the official source you will still not be able to use datepicker.

comment:12 Changed 4 years ago by scott.gonzalez

  • Priority changed from blocker to major

comment:13 Changed 2 years ago by metaweta

The same underlying problem prevents datepicker from working on Google Sites' HTMLBox.

comment:14 Changed 2 years ago by metaweta

This commit enables all of the click and change events:  https://github.com/metaweta/jquery-ui/commit/df77b43f08c593ed5a21323c02cc51b8ada37b02

comment:15 Changed 2 years ago by scott.gonzalez

#8239 is a duplicate of this ticket.

comment:16 Changed 2 years ago by scott.gonzalez

#8290 is a duplicate of this ticket.

comment:17 Changed 2 years ago by scott.gonzalez

  • Summary changed from DatePicker does not respond to any click events in AIR to DatePicker does not respond to any click events in AIR, Google Sites, Windows Metro

comment:18 Changed 2 years ago by metaweta

Given the longstanding demand for this bug and the existence of a fix, can we get the status returned to blocker?

comment:19 Changed 23 months ago by Mike Stay

  • Status changed from new to closed
  • Resolution set to fixed

Datepicker: Pulled event handlers into static code. Fixed #3945 - DatePicker does not respond to any click events in AIR, Google Sites, Windows Metro.

Changeset: 6dcc5c14c824ae9d653b1bc293680f6af6baf1b4

comment:20 Changed 23 months ago by Mike Stay

Datepicker: Pulled event handlers into static code. Fixed #3945 - DatePicker does not respond to any click events in AIR, Google Sites, Windows Metro. (cherry picked from commit 6dcc5c14c824ae9d653b1bc293680f6af6baf1b4)

Changeset: 831333a10aebad00b30d51cb274f463240c56814

comment:21 Changed 23 months ago by scott.gonzalez

  • Milestone changed from 1.next to 1.8.22

comment:22 Changed 18 months ago by mikesherov

#7826 is a duplicate of this ticket.

comment:23 Changed 8 months ago by vovina

I didnt get the final solution How can I modify the date picker to be able to use click event. thanks

Note: See TracTickets for help on using tickets.