EasyUI Forum
May 15, 2024, 09:57:50 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combobox keyHandler  (Read 10111 times)
chrwei
Full Member
***
Posts: 219


View Profile Email
« on: March 26, 2015, 10:31:29 AM »

I'm having trouble extending the Combobox's keyhandler.  I want that without the list dropped down that using up and down arrow keys will cycle though the list just like when it is extended.  I've gotten that to work, but then the auto-complete feature stopped working. 

I think what I need is that in my function I have to detect when the panel is open and then call the default key handle functions, but $.fn.combobox.defaults.keyHandler is all empty so I'm unsure of what I can do to restore the default behavior.

I'm extending like: 
Code:
keyHandler: $.extend($.fn.combobox.defaults.keyHandler, { my stuff here }
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #1 on: March 26, 2015, 02:31:50 PM »

more info:  $.extend seems to change global, not just for that for that instance.  

and I got it worked out, here's my solution: http://test.mywilsonmfg.com/test.php  the first box is the default behavior, the 2nd is my additions.  the comboUp and comboDown functions should work with any instance of a combobox,
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #2 on: March 26, 2015, 08:08:32 PM »

please add empty object, it will not override global,

Code:
$.extend({},$.fn.combogrid.defaults.keyHandler,{
// your stuff
})

hope it help you.
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #3 on: March 26, 2015, 08:21:17 PM »

ah, I see how I did that wrong now.  still, needed to detect if the panel if visible and call the original to retain that behaviour. 

IMO, it's a bit of a documentation gap, everything looks like the keyHandlers don't do anything, but when the panel is open they most certainly do things.
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!