Ticket #3945 (new bug)

Opened 2 years ago

Last modified 8 months ago

DatePicker does not respond to any click events in AIR

Reported by: canthonyza Owned by:
Priority: major Milestone: 1.next
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 2 years ago.

Change History

comment:1 Changed 2 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 2 years ago by hackfrag

comment:2 Changed 2 years ago by hackfrag

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

comment:3 Changed 2 years ago by hackfrag

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

comment:4 Changed 2 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 2 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 2 years ago by ckng

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

comment:7 Changed 17 months 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 15 months 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 14 months 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 14 months 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 8 months ago by scott.gonzalez

  • Priority changed from blocker to major
Note: See TracTickets for help on using tickets.