Sproutcore 2.0文本字段焦点事件

问题描述:

有谁知道我在哪里可以找到文本字段的偶数列表?Sproutcore 2.0文本字段焦点事件

我需要的焦点事件,如果你想设置焦点找不到他的名字

,你可以使用jQuery:

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

如果你想处理事件,看到SC.EventDispatcher获取支持事件的列表。我想你想要focusInfocusOut

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' 
}; 

例如:

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; 
    } 
});