Domanda

Does anyone know where can I find the even list of a Text Field?

I need the focus event, and can't find his name

È stato utile?

Soluzione

If you want to set focus, you can just use jQuery:

$('#textFieldId').focus();

If you wish to handle events, see SC.EventDispatcher for a list of supported events. I think you want focusIn or focusOut.

 var event, events = {
  touchstart  : 'touchStart',
  touchmove   : 'touchMove',
  touchend    : 'touchEnd',
  touchcancel : 'touchCancel',
  keydown     : 'keyDown',
  keyup       : 'keyUp',
  keypress    : 'keyPress',
  mousedown   : 'mouseDown',
  mouseup     : 'mouseUp',
  click       : 'click',
  dblclick    : 'doubleClick',
  mousemove   : 'mouseMove',
  focusin     : 'focusIn',
  focusout    : 'focusOut',
  mouseenter  : 'mouseEnter',
  mouseleave  : 'mouseLeave',
  submit      : 'submit',
  change      : 'change',
  dragstart   : 'dragStart',
  drag        : 'drag',
  dragenter   : 'dragEnter',
  dragleave   : 'dragLeave',
  dragover    : 'dragOver',
  drop        : 'drop',
  dragend     : 'dragEnd'
};

For example:

App.TextBoxView = SC.TextField.extend({
    attributeBindings: ['type', 'placeholder', 'value', 'name', 'tabindex', 'disabled', 'readonly'],

    name: '',

    tabindex: '1',

    disabled: NO,

    readonly: NO,

    focusIn: function(event) {
       // your code
       return false;
    },

    focusOut: function(event) {
       this._elementValueDidChange();
       return false;
    }
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top