EasyUI Forum
June 24, 2024, 04:59:55 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: timespinner save value onblur  (Read 6244 times)
gordis gmbh
Full Member
***
Posts: 103


View Profile Email
« on: September 14, 2015, 10:14:21 AM »

I have a timespinner and want to trigger save-function once the user spins/types to set the time and leaves the spinner(onblur). But the problem is, the onblur event gets triggered even during the spinner is spinned! I think this is a bug.
Please find a demo here:http://jsfiddle.net/gk4bgo66/

Calling the save-function for every spin is not good. Any idea how this can be handled?

Thanks for your help.
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #1 on: September 14, 2015, 01:15:20 PM »

since you're putting on the blur on the textbox itself, clicking the arrows triggers a blur.  one thing I can think of is to have the blur check e.relatedTarget to see if it's one of the arrows, and if it is, don't submit.
Logged
gordis gmbh
Full Member
***
Posts: 103


View Profile Email
« Reply #2 on: September 15, 2015, 09:10:16 AM »

Thanks for the clue - it did help me get further.

However, i'm not sure if relying on spin-arrows will be good because there are multiple closely located spinners on the page and hence I thought, I will use "document.activeElement" to check if the focus is still on the spinners:: http://jsfiddle.net/2hy9jz2h/

The problem with this approach is that the save doesn't get called if the focus is out of the document!

Any further hints will be of great help. Thanks.

Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #3 on: September 15, 2015, 11:48:00 AM »

there's probably a cleaner way, but this works http://jsfiddle.net/cqfra40y/
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!