ITeye博客

ExtJs NumberField或TextField不能处理KeyPress问题

guojian3021886 · 2009-10-29 09:07 · EXT · EXT · Markdown

keyup,keydown,keypress,都试试,当初郁闷了我很久。

Form控件的
NumberField (或TextField)不能获取键盘事件,可以试试以下方法。

    var barcode = new Ext.form.NumberField({
        allowDecimals: false,
        decimalPrecision: 0,
        allowNegative: false,
        selectOnFocus: true,
        allowBlank: true,
        applyTo: 'txtCard',
        emptyText: '- Scan -'
    });

    Ext.get(barcode.el).on('keyup', function(e) {
    //do something
  }

评论(2)

  1. #2 楼 · bivin0603 · 2012-03-27 14:57

    楼上正解,支持

  2. #1 楼 · arthur_jiang · 2010-09-01 11:35

    This event only fires if enableKeyEvents is set to true.

    API的说明里有这么一句.看楼主的代码好象少了enableKeyEvents的设置.

评论功能维护中,当前仅展示历史评论。