问题描述
- 求助Ext window二次打开问题
-
在grid列表通过Ext.create('App.good.GoodRecommend').show()打开window,第一次都是正常的,第二次打开就会是这样的效果
然后选中的值和填的排序号也无法获取到,请大神帮忙一下Ext.define('App.good.GoodRecommend', { extend: 'Ext.window.Window', title: '商品推荐位置', width: 300, height:200, modal: true, resizable: false, closeAction : 'close', id:'goodRecommend', layout: 'fit', onEsc: function () { this.close(); }, constrainHeader: true, initComponent: function () { this.items = this.createForm(); this.buttons = this.createBtns(); this.callParent(arguments); }, //表单form createForm: function () { return { xtype: 'form', id:'recommendForm', bodyPadding: 10, border: false, autoScroll: true, fieldDefaults: { labelAlign: 'right', labelWidth: 90, labelStyle: 'color:green;padding-left:4px' }, items: [{ xtype: 'radiogroup', id: 'radioName', name: 'radioName', autoHeight: true, layout:'form', columns: 6, border: true, anchor: '100%' }] }; }, //按钮列表 createBtns: function () { return [{ text: '确定', scope: this, formbind: true, handler: this.goodsRecommend }, { text: '取消', scope: this, handler: function(){ this.close(); } }]; }, goodsRecommend:function(){ var position = ''; var positionId = ''; var rdItems = Ext.getCmp('radioName').items; for(var i=0;i < rdItems.length;i++){ if(rdItems.get(i).checked){ position = rdItems.get(i).boxLabel; positionId = rdItems.get(i).inputValue ; } } var sort = Ext.getCmp('sort').getValue(); if(positionId == ""){ Ext.MessageBox.confirm('提示', "商品推荐位置不能为空!"); }else{ Ext.Ajax.request({ method: 'POST', url: basePath + '/good/goodRecommend.html', params: { 'goodsId': goodsId, 'positionId':positionId, 'position':position, 'recommendSort':sort }, success: function() { Ext.getCmp('goodGrid').getStore().reload(); Ext.getCmp('goodRecommend').close(); Ext.getCmp('recommendForm').getForm().reset(); Ext.getCmp('sort').reset(); success(); }, error: function() { error(); } }); } } }); Ext.Ajax.request({ url: basePath + '/good/queryParamDetail.html', params : {'groupId':'DJBH151202001'}, success: function(response) { var res = eval("("+response.responseText+")"); var radiogroup = Ext.getCmp("radioName"); for (var i = 0; i < res.length; i++) { var radio = new Ext.form.Radio({ boxLabel: res[i].name, name: 'recommendGood', inputValue:res[i].value }); radiogroup.items.add(radio); } var n = new Ext.form.NumberField({ fieldLabel: "排序", id: "sort", labelWidth: 40, width: 100 , allowDecimals:false, maxValue: 99, minValue: 1 }) ; Ext.getCmp('recommendForm').items.add(n); Ext.getCmp('recommendForm').doLayout(); } });
时间: 2024-12-22 22:43:47