Results 1 to 3 of 3

Thread: How to capture Delete key in grid

  1. #1
    Sencha Premium User
    Join Date
    Apr 2011
    Posts
    108
    Answers
    1

    Default How to capture Delete key in grid

    Hello,

    Using EXTJS 6.5.3. I would like to capture a Delete key press on a grid panel. The panel has a ViewController and I have tried a few things with no success.

    Grid Panel:
    Code:
    Ext.define('Designer.view.logs.TransMasterGrid', {
        extend: 'Ext.grid.Panel',
        xtype: 'transmastergrid',
    
        itemId: 'transmastergrid',
        reference: 'transmastergrid',
        controller: 'transmastercontroller',
    ....
    ViewController:
    Code:
    Ext.define('Designer.view.logs.TransMasterController', {
        extend: 'Ext.app.ViewController',
        alias: 'controller.transmastercontroller',
    
        listen: {
            controller: {
                 'panel': {
                     specialkey: this.onSpecialKey
                }, 
                '#transmastergrid': {
                     specialkey: this.onSpecialKey
                }
            }
        },
        
        init: function() {
            this.control({
                  'panel': {
                     specialkey: this.onSpecialKey
                }, 
                '#transmastergrid': {
                     specialkey: this.onSpecialKey
                },
             });
        },
        
        onSpecialKey: function(field, event, options) {
            console.log('onSpecialKey..');
            if (event.getKey() == event.DELETE) {
                console.log('onSpecialKey Delete encountered..');
            }
        },
    ...
    None of the listeners seem to work. Any help would be appreciated.

    Thank you
    Rudy

  2. #2
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    Quick fiddle setting the itemkeydown event on the view;


  3. #3
    Sencha Premium User
    Join Date
    Apr 2011
    Posts
    108
    Answers
    1

    Default

    Thank you Johnny, I did not use your code exactly but instead found the grid panel event rowkeydown. You led me to it! Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •