【发布时间】:2013-06-06 16:33:31
【问题描述】:
我正在尝试选择我的列的 itemid 编辑器,但我无法拦截来自控制器的事件。
查看:
Ext.define('MyApp.view.fatturaVendita.FatturaVendita', {
extend: 'Ext.window.Window',
height: 700,
id: 'fatturaVendita',
width: 1000,
collapsible: true,
title: 'Fattura Vendita',
maximizable: true,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
.....
xtype: 'gridcolumn',
itemId: 'clnCodiceArticolo',
width: 45,
sortable: false,
dataIndex: 'CodiceArticolo',
text: 'Art.:',
editor: {
xtype: 'textfield',
itemId: 'txtCodiceArticolo',
msgTarget: 'side'
}
},
......
控制器:
......
this.control(
'#fatturaVendita #txtCodiceArticolo':
{
afterrender: function (f, e) {
alert("change");
},
specialkey: function (f, e) {
alert(specialkey);
var me = this;
if (e.getKey() == e.ENTER) {
if (getWin(me.getIdWin(), '#txtCodiceArticolo').getValue() == "") {
Ext.create('MyApp.view.fatturaVendita.Ricerca', { grd: "grdCorpoFatturaVendita", store: "ArticoloStore", dataDescrizione: "Descrizione", testoDescrizione: "Descrizione", idCampo: f.id, codice: f.name, descrizione: "DescrizioneArticolo" }).show();
}
}
},
},
......
我的网格列和编辑器的所有字段都使用 itemid,我仅将 id 用于我的窗口“fatturaVendita”。 但是这段代码不起作用。我该怎么办? =(
类似于这个例子,但我不能让它工作。我似乎无法拦截网格文本字段的事件 SpecialKey: http://jsfiddle.net/brux88/S2rdL/20/
**
更新:
** 谢谢你的帮助,现在工作,但我不明白。我有一个多窗口应用程序。我将 itemid 用于控件,而每个窗口仅使用 id。如果我有两个窗口并且我有相同的 itemid (txtCodiceArticolo) extjs 如何确定我想要释放哪个事件?事实上,如果我在我的控制器中使用
this.control({
'#idWindows #itemId': {
specialkey: function (f, e) {
if (e.getKey() == e.ENTER) {
alert("2");
}
}
}
。我不只是为专栏编辑工作。
【问题讨论】:
-
你能创建一个小提琴来演示你的问题吗?
-
嗨,因为我使用 sencha architectureh 作为我的视图,所以我尝试使用 make un jfiddle。我想拦截控制器,我的列文本字段的特殊键事件,已分配项目 ID
标签: javascript extjs4