点击参照:弹出Window 如果直接勾选数据行 点提交 按钮 值能够传到EditorGridPanel 的cell 里面
点击参照:弹出Window 如果不直接勾选数据行(此时“焦点不在EditorGridPanel 的cell上了”) 点提交 按钮 值不能够传到EditorGridPanel 的cell 里面。
下面是TriggerField扩展成参照的 JS:
Ext.form.ShiftDefRefField = Ext.extend(Ext.form.TriggerField, {
triggerClass: 'x-form-search-trigger',
initComponent: function () {
Ext.form.ComboBox.superclass.initComponent.call(this);
this.ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({ url: '/HRM/geAllPersonfor', method: 'GET' }),
reader: new Ext.data.JsonReader({ totalProperty: 'TotalCount', root: 'Data', id: 'F_PERSONNO' },
[{ name: 'F_PERSONNO' }, { name: 'F_PSNNAME' }, { name: 'F_GRP_NAME' }, { name: 'F_STATIONAME'}])
});
this.ButtonOK = new Ext.Button({ id: 'RefButtonOK', text: '提交', tooltip: '单个人员选择', iconCls: 'add_btn' });
this.TextField = new Ext.form.TextField({ id: 'queryParamref', name: 'queryParamref', emptyText: '岗位编码|岗位名称', enableKeyEvents: true, listeners: {
specialkey: function (field, e) {
if (e.getKey() == Ext.EventObject.ENTER) {
queryDeptItem();
}
}
},
width: 130
});
this.sm = new Ext.grid.CheckboxSelectionModel();
this.cm = new Ext.grid.ColumnModel([
this.sm,
{ header: '人员编码', width: 100, dataIndex: 'F_PERSONNO', sortable: true },
{ header: '人员姓名', width: 100, dataIndex: 'F_PSNNAME', sortable: true },
{ header: '所属部门', width: 100, dataIndex: 'F_GRP_NAME', sortable: true },
{ header: '岗位', width: 100, dataIndex: 'F_STATIONAME', sortable: true}]);
// 翻页排序时带上查询条件
this.ds.on('beforeload', function () {
this.baseParams = {
queryParamref: Ext.getCmp('queryParamref').getValue()
};
});
// 分页工具栏
var bbar = new Ext.PagingToolbar({
pageSize: 20,
store: this.ds,
displayInfo: true,
displayMsg: '显示{0}条到{1}条,共{2}条',
emptyMsg: "没有符合条件的记录"
});
this.gridMain = new Ext.grid.GridPanel({
store: this.ds,
cm: this.cm,
sm: this.sm,
stripeRows: true,
height: 300,
width: 500,
loadMask: true,
bbar: bbar,
tbar: [
this.ButtonOK, '->', this.TextField, {
text: '查询',
iconCls: 'find_btn',
handler: function () {
queryDeptItem();
}
}]
});
var store = this.ds;
function queryDeptItem() {
store.load({
params: {
start: 0,
limit: bbar.pageSize,
queryParamref: Ext.getCmp('queryParamref').getValue()
}
});
}
this.windowRef = new Ext.Window({
layout: 'fit',
modal: true,
height: 300,
width: 500,
title: '人员参照',