Editor Inline Datepicker Blur Focus Issue

Editor Inline Datepicker Blur Focus Issue

MrNazgulMrNazgul Posts: 8Questions: 4Answers: 2

Key Points:

  • I'm using editor primarily for inline editing scenarios.
  • Using bootstrap datepicker.
  • Using moment.js for custom time formatting.
  • I'm overriding Editor's default ajax call in order to handle some more complex data structure scenarios, support some undo functionality at the granularity I need, as well as I don't have direct access to the database on the back end. (Not as relevant to my issue)

Problem: I hit {enter} on a cell containing a date to bring up the datepicker. As soon as I click on a date or go forward/backward a month, the inline input/cell in the datatable loses focus and my ajax override gets hit prior to the date actually being clicked and submitted by the datepicker.

Attempted Solution

Dates (with jQuery UI datepicker)
This thread seemed promising, but the approach (shown here) didn't work. The event never fired.

editor.on('preBlur', function () {
  if ( $('#ui-datepicker-div').length ) {
    return false;
  }
} );

Example:

You can experience the same issue I'm having in the following example on this site:
AutoFill and KeyTable together

Follow my procedure described in my problem on the Start Date column.

I'm pretty certain this wasn't an issue for me at an earlier point in development, but I have updated the datatables and relevant plugins at least once since I began this project. I'm guessing since the issue is seen on this site with current library versions that it may be a regression that's crept in.

I'd love to hear any feedback/solutions from Allan or anyone else who's spent any time with this issue. I'm going to forge on with other tasks and not spend time delving into this as I suspect Allan might slip a fix into an update in the near future if this is indeed a regression issue.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,710Questions: 1Answers: 10,103 Site admin
    Answer ✓

    Hi,

    Thanks for the question - very nicely framed!

    I knew I'd seen something about this before and with a quick bit of digging I found I've actually fixed the issue you are seeing already, but it hasn't yet made it to the release software.

    This is the fix in question. If you use the nightly version of KeyTable that will contain the fix. I plan to do a release of Editor before the end of the month and will dump KeyTable at the same time.

    Regards,
    Allan

  • mridulap2003mridulap2003 Posts: 2Questions: 1Answers: 0

    Hi Allan,

    I had the same issue as the OP here and I am using KeyTable 2.5.0.
    I had to add the following to dataTables.keyTable.js to make it work (at line 220):

    if ( $(e.target).parents('#ui-datepicker-div').length ) {
        return;
    }
    
This discussion has been closed.