請檢查此fiddle。我在ExtJs 4.1 textareafield中粘貼了一些值,但我無法獲得該字段的值。請建議獲取粘貼事件中的值的方法。無法在粘貼事件中獲取ExtJs 4.1中textareafield的值
Ext.onReady(function() {
Ext.create('Ext.window.Window', {
height: 60,
layout: 'anchor',
minHeight: 60,
width: 200,
items: [{
grow: true,
anchor: '100%',
flex: 1,
enableKeyEvents: true,
xtype: 'textareafield',
id: 'txtFld',
listeners: {
keydown: function (txtArea, e, eOpts) {
//console.log(e.getKey());
if (e.keyCode == 13 && txtArea.value.split("\n").length >= 5) {
console.log('unable to stop :(');
e.stopEvent();
return false;
}
},
paste: {
element: 'inputEl',
fn: function (event, inputEl) {
if (event.type == "paste") {
console.log('in pasted');
console.log("inputEl.value >> " + inputEl.value);
console.log("inputEl.innerHTML >> " + inputEl.innerHTML);
console.log("inputEl.innerText >> " + inputEl.innerText);
console.log("inputEl.outerText >> " + inputEl.outerText);
console.log("inputEl.outerText >> " + inputEl.outerText);
console.log(' Ext Val >> ' +Ext.getCmp('txtFld').value);
//event.preventDefault();
//return false;
}
}
}
}
}]
}).show();
});
謝謝你的回覆。你能告訴我如何延遲這個事件嗎?還有沒有其他方式來處理ExtJs中的粘貼事件? – SharpCoder
明白了。謝謝 !! – SharpCoder