iteye_20681 2009-10-23 09:50
浏览 245
已采纳

EXtjs TriggerField 在表单中关闭后第二次弹出不显示 {急】

//扩展重写TriggerField

Ext.form.ShiftDefRefContentTab = Ext.extend(Ext.form.TriggerField, {
triggerClass : 'x-form-ref-trigger',
fieldLabel : ' 选择节目包标识 ',
name : 'contentId',
width : 150,
initComponent : function() {
Ext.form.ComboBox.superclass.initComponent.call(this);
this.ds = new Ext.data.Store({// 任务日志的Store
proxy : new Ext.data.HttpProxy({
url : "listContentGrid.action"
}),
reader : new Ext.data.JsonReader({
root : 'root'
}, [{
name : "contentTypeTab.typeName"
}, {
name : 'secOperator.logonName'
}, {
name : 'metaDefineTab.chupingren'
}, {
name : 'name'
}, {
name : 'contentId'
}, {
name : 'createTime'
}, {
name : 'contentId'
}])
})
this.ButtonOK = new Ext.Button({
id : 'RefButtonOK',
text : '添加记录',
// iconCls : 'x-icon-subscriptions',
tooltip : '添加',
// Cls : 'images/business/image_add.png'
iconCls : 'images/add.png'
});
this.sm = new Ext.grid.CheckboxSelectionModel();
this.cm = new Ext.grid.ColumnModel([this.sm, {
header : "包名称",
dataIndex : 'name',
align : 'center'
}, {
header : '类型',
dataIndex : 'contentTypeTab.typeName',
// width : 150,
align : 'center'
}, {
header : '出品人',
dataIndex : 'metaDefineTab.chupingren',
// width : 150,
align : 'center'
}, {
header : "操作员",
id : 'content',
dataIndex : 'secOperator.logonName',
// width : 150,
align : 'center'

            }])
    this.gridMain = new Ext.grid.GridPanel({
                store : this.ds,
                cm : this.cm,
                sm : this.sm,
                stripeRows : true,
                height : 300,
                width : 500,
                loadMask : true,
                bbar : new Ext.PagingToolbar({
                            pageSize : 20,
                            store : this.ds,
                            displayInfo : true,
                            // displayMsg: 'From {0} to {1} ,
                            // total:
                            // {2}',
                            emptyMsg : "No record"
                        }),

                tbar : new Ext.Toolbar({
                            items : [this.ButtonOK]
                        })
            });

    this.windowRef = new Ext.Window({
                //layout : 'fit',
                modal : true,
                height : 300,
                width : 500,
                title : '请选择一列值',
                //closeAction : 'hide',
                iconCls : 'images/add.png',
            //  plain : true,
                items : this.gridMain
            });
    this.ButtonOK.on('click', this.ButtonOK_Click, this, {
                preventDefault : true
            });
},

ButtonOK_Click : function() {
    var selectedItems = this.gridMain.selModel.selections.keys;
    if (selectedItems.length == 0) {
        Ext.MessageBox.alert("请选择一条记录");
    } else {
        var selectedRow = this.gridMain.getSelectionModel().getSelected();
        this.windowRef.close();
         this.setValue(selectedRow.get('contentId'));
        var text = selectedRow.get('contentId');
        Ext.form.ShiftDefRefContentTab.superclass.setValue.call(this, text);
    }
},
onTriggerClick : function() {
    this.ds.load({
                params : {
                    start : 0,
                    limit : 15
                }
            });
    this.windowRef.show();
}

});

//应用扩展的TriggerField

var EsgTab_id = new Ext.form.ShiftDefRefEsgTab();
var ContentTab_id = new Ext.form.ShiftDefRefContentTab();
var EsgTimeSpanTab_id = new Ext.form.ShiftDefRefEsgTimeSpan();

function doAddEsg() {
var addSimpleForm = new Ext.FormPanel({
labelWidth : 75,
frame : true,
title : '节目单',
bodyStyle : 'padding:5px 5px 0',
width : 500,
layoutConfig : {
columns : 3,
align : 'top'
},
defaults : {
width : 200
},
defaultType : 'textfield',
// items : [{
// xtype : 'textfield',
// fieldLabel : '包名称',
// name : 'name',
// anchor : '75%'
// },EsgTimeSpanTab_id],
items : [EsgTimeSpanTab_id, EsgTab_id, ContentTab_id],
buttons : [{
text : '添加',
type : 'submit',
handler : function() {
addSimpleForm.getForm().doAction('submit', {
url : 'doAddEsgRel.action',
method : 'post',
params : {
esgTabId : addSimpleForm.getForm()
.findField('esgId').getValue(),
contentId : addSimpleForm.getForm()
.findField('contentId').getValue(),
esgTimespanId : addSimpleForm.getForm()
.findField('esgTimespanId').getValue()
},
success : function(result) {
win.close();
Ext.MessageBox.alert("成功");
esgGrid.store.reload({
callback : function() {
esgGrid.getView().refresh();
}
});

                        },
                        failure : function() {
                            Ext.MessageBox.alert("失败");
                        }
                    });

                }
            }, {
                text : '退出',
                handler : function() {
                    win.close();
                }
            }]

        })

var win = new Ext.Window({
            title : ' 添加 ',
            height : 150,
            width : 400,
            resizable : false,
            frame : true,
            autoHeight : true,
            modal : true,
            items : [addSimpleForm]
        })
win.show()

}

temp.PNG(第一次弹出的form中可以看到的图片 中有TriggerField)
temp-1.PNG(第二次点击”退出“ 弹出的form中可以看到的图片 中没有TriggerField在表单中)

请大侠给我看看 非常感谢

  • 写回答

1条回答 默认 最新

  • zhoujuan520 2009-10-24 05:15
    关注

    id : 'RefButtonOK', ...................

    在类中不要使用id,在对象里面可以使用 id是标识,表示唯一,你创建的第一个对象中包含了这些唯一组件,当你关闭时这些组件的dom消失,但是id仍然存在...问题就出在这里

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译