How to clone jquery datepicker? -


i need clone (to inherite) datepicker jquery object , override _generatedhtml method. code:

$.fn.datepickerext = $.fn.datepicker; var datepickeroldhtml = $.datepicker._generatehtml;  var datepickerext = $.extend($.datepicker, {     _generatehtml: function(inst) {         var generatedhtml = datepickeroldhtml.apply(this, arguments);         return "<div style='text-align:center'>header</div>"+generatedhtml;     } }) 

but not sure have different objects $.fn.datepicker , $.fn.datepickerext..

link jsfiddle: http://jsfiddle.net/konstantin/9rjna/

in case header need added datepickerext...

i come across same problem , after gone through suggested solution, got way out.

$('#actions').append($new_row); $('#actions').find('input.datepicker').removeclass("hasdatepicker").removeattr('id'); $('#actions').find('button.ui-datepicker-trigger').remove(); $('#actions').find('input.datepicker').unbind(); $('#actions').find('input.datepicker').datepicker('destroy'); $('#actions').find('input.datepicker').datepicker( {    autosize:false,    showon:'button',    dateformat:'yy-mm-dd',    weekheader: 'w',    showweek: true,    firstday: 0,    changemonth: true,    changeyear: true,    gotocurrent:true,    showbuttonpanel:true,    showanim:'',    duration:'fast' } ); 

after insert cloned elements (within id "actions"):

  1. remove every datepicker id detected otherwise new created datepicker still stick particular input id
  2. remove datepicker button or duplicate on cloned element
  3. unbind datepicker (don't know must)
  4. destroy datepicker
  5. now clean-up, re-initialize datapicker event

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -