开发者

Jeditable Datepicker onblur problem

开发者 https://www.devze.com 2022-12-27 14:36 出处:网络
I am using inline editing using Jeditable and datepicker. I have a column in my table which displays Date as a hyperlink. When I click on this it shows me the datepicker. And when a particular date is

I am using inline editing using Jeditable and datepicker. I have a column in my table which displays Date as a hyperlink. When I click on this it shows me the datepicker. And when a particular date is selected its updated in the backend and the cell now is updated with the changed value. However, am having problem with onblur event while changing month or years. This event gets triggered when I click on "Prev" or "Next" buttons on the datepicker control. This causes an exception when the date is selected. This works fine as long as the date selected is in the current month. I tried all possible solutions listed here:

stackoverflow.com/questions/2007205/jeditable-datepicker-causing-blur-when-changing-month

If settimeout the control does not change back to a normal hyperlink on closing the datepicker or on a true onblur event.

Here's my code,

$.editable.addInputType('datepicker', { element : function(settings, original) { var input = $(''); if (settings.width != 'none') { input.width(settings.width); } if (settings.height != 'none') { input.height(settings.height); } input.attr('autocomplete','off'); $(this).append(input); return(input); }, plugin : function(settings, original) { var form = this;

    settings.onblur = function(e) { 
        t = setTimeout(function() {
         original.reset.apply(form, [settings, self]);
        }, 100);
     };

    $(this).find('input').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'dd-M-y',
        closeAtTop: true,
        onSelect: function(dateText) { $(this).hide(); $(form).trigger('submit'); }
    });            
},
submit  : function(settings, original) { }

});

$(function() { $('.edit_eta').editable('update_must_fix_eta.php', { id: 'bugid', name: 'eta', type: 'datepicker', event: 'click', select : true, width: '50px', onblur:'cancel', cssclass : 'editable', indicator : 'Updating ETA, please wait.', style : 'inherit', submitdata:{version:'4.2(4)',tag:'REL_4_2_4',qstr:1} }); });

I tried hacking jedit开发者_JS百科able.js as mentioned on this link: http://groups.google.com/group/jquery-dev/browse_thread/thread/265340ea692a2f47

Even this does not help.

Any help is appreciated.


Have you tried jeditable-datepicker plugin? It seems to do exactly what you need.

It enables jQuery UI Datepicker in Jeditable. Here's the demo.


Yes, I was using the same. I had to disable Prev and Next buttons which navigate to previous and next months respectively. I display 3 months calendar when the link is clicked and if the user wants to enter a date which does not fall in any of these 3 months I let him enter it manually by making the input text box editable. That solved my problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消