EasyUI Forum
May 04, 2024, 01:21:34 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: cell editing and combobox mouse click for selection not working [SOLVED]  (Read 4739 times)
rannacher
Jr. Member
**
Posts: 52


View Profile
« on: December 01, 2020, 03:33:23 PM »

Hi,

I am using cell editing with combobox and with below code the key nav incl. enter / endediting works fine.
Quote
                                 keyHandler: $.extend({},$.fn.combobox.defaults.keyHandler,{
                                      down: function(e){
                                          $(this).combobox('showPanel');
                                          $.fn.combobox.defaults.keyHandler.down.call(this,e);
                                      }
                                  }),

Also managed to have the panel open when clicking the combobox with 'showPanel' ,
just when I click one of the entries in the dropdown the panel then just closes,
but simply not the "same" happens as when pressing "enter" with kay nav -
means f.e. that onAfterEdit is not called (like when key nav enter pressed) where all the saving happens.

And when I try adding "endEdit" in onChange of the combobox editor then all gets messed up,
because combobox obviously also tiggers onChange with the initial click on the combobox...

Please for help how to get right... and thx a lot in advance!

BR Mike.
« Last Edit: December 10, 2020, 03:21:05 PM by rannacher » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: December 02, 2020, 07:09:54 PM »

Please look at this example http://code.reloado.com/ebedit3/edit#preview. No matter press ENTER or click the mouse to edit a cell, when pressing ENTER or click on other cells to end the editing action, the 'onAfterEdit' event fires.
Logged
rannacher
Jr. Member
**
Posts: 52


View Profile
« Reply #2 on: December 04, 2020, 09:46:18 AM »

Hi Jarry,

thx for reply - but in the example you refer to, exactly the event 'onAfterEdit' is not fired,
when you click the comboxbox and then click/select an entry in the dropdown panel.
Thats exactly what I would expect and need, that this event 'onAfterEdit' fires, but it just closes the dropdown...

Thx Mike!
Logged
rannacher
Jr. Member
**
Posts: 52


View Profile
« Reply #3 on: December 08, 2020, 04:12:17 AM »

Any help?

Cannot just trigger endEdit or react on onSelect/onChange event, as this interferes with the edit mode and initial load of the combobox.
I just want, that when click in the dropdown panel, then it is already like the "enter" needed to be pressed afterwards.
Because mouse click and then having to press enter with keyboard is not convenient for the user.

Thx again, Mike.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #4 on: December 10, 2020, 04:29:38 AM »

Try to listen to the 'onClick' event and trigger the ENTER event when clicking on a row.
Code:
type:'combobox',
options:{
    data:data.rows,
    valueField:'productid',
    textField:'productid',
    keyHandler: $.extend({},$.fn.combobox.defaults.keyHandler,{
        down: function(e){
            $(this).combobox('showPanel')
            $.fn.combobox.defaults.keyHandler.down.call(this,e);
        }
    }),
    onClick: function(row){
        var input = $(this).combobox('textbox');
        setTimeout(function(){
            var event = new $.Event('keydown');
            event.keyCode = 13;
            input.trigger(event)

        },50)
    }
}

Please look at this example http://code.reloado.com/ebedit3/2/edit#preview
Logged
rannacher
Jr. Member
**
Posts: 52


View Profile
« Reply #5 on: December 10, 2020, 03:20:48 PM »

Jarry, works like a charm - THANKS A LOT!!!!

BR Mike.
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!