Skip to content

Commit

Permalink
Merge pull request #1 from ejdraper/master
Browse files Browse the repository at this point in the history
Ability to passthrough custom datepicker arguments
  • Loading branch information
qertoip committed May 11, 2011
2 parents 3ad477f + c5f65e7 commit 05318a2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
12 changes: 9 additions & 3 deletions src/jquery.jeditable.datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ $.editable.addInputType( 'datepicker', {

// Don't cancel inline editing onblur to allow clicking datepicker
settings.onblur = 'nothing';
input.datepicker( {

datepicker = {
onSelect: function() {
// clicking specific day in the calendar should
// submit the form and close the input field
Expand All @@ -63,6 +63,12 @@ $.editable.addInputType( 'datepicker', {
// without a delay the form is submitted in all scenarios, which is wrong
}, 150 );
}
} );
};

if (settings.datepicker) {
jQuery.extend(datepicker, settings.datepicker);
}

input.datepicker(datepicker);
}
} );
8 changes: 6 additions & 2 deletions test/javascripts/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ $( document ).ready( function() {
date.html( value );
},
{
type: 'datepicker'
type: 'datepicker',
datepicker: {
changeMonth: true,
changeYear: true
}
}
);

} );
} );
12 changes: 9 additions & 3 deletions test/javascripts/jquery.jeditable.datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ $.editable.addInputType( 'datepicker', {

// Don't cancel inline editing onblur to allow clicking datepicker
settings.onblur = 'nothing';
input.datepicker( {

datepicker = {
onSelect: function() {
// clicking specific day in the calendar should
// submit the form and close the input field
Expand All @@ -63,6 +63,12 @@ $.editable.addInputType( 'datepicker', {
// without a delay the form is submitted in all scenarios, which is wrong
}, 150 );
}
} );
};

if (settings.datepicker) {
jQuery.extend(datepicker, settings.datepicker);
}

input.datepicker(datepicker);
}
} );

0 comments on commit 05318a2

Please sign in to comment.