forked from NicolasCARPi/jquery_jeditable
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jquery.jeditable.datepicker.js
49 lines (48 loc) · 1.36 KB
/
jquery.jeditable.datepicker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Datepicker for Jeditable (currently buggy, not for production)
*
* Copyright (c) 2007-2008 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Depends on Datepicker jQuery plugin by Kelvin Luck:
* http://kelvinluck.com/assets/jquery/datePicker/v2/demo/
*
* Project home:
* http://www.appelsiini.net/projects/jeditable
*
* Revision: $Id$
*
*/
$.editable.addInputType('datepicker', {
/* create input element */
element : function(settings, original) {
var input = $('<input>');
$(this).append(input);
//$(input).css('opacity', 0.01);
return(input);
},
/* attach 3rd party plugin to input element */
plugin : function(settings, original) {
/* Workaround for missing parentNode in IE */
var form = this;
settings.onblur = 'cancel';
$("input", this)
.datePicker({createButton:false})
.bind('click', function() {
//$(this).blur();
$(this).dpDisplay();
return false;
})
.bind('dateSelected', function(e, selectedDate, $td) {
$(form).submit();
})
.bind('dpClosed', function(e, selected) {
/* TODO: unneseccary calls reset() */
//$(this).blur();
})
.trigger('change')
.click();
}
});