在我的代码中:
我有这个Application.DashBoardForm.Js,我想在onclick事件函数中传递fromdate的值,我怎样才能传递fromdate值?
Ext.apply(Ext.form.VTypes,{ daterange : function(val,fIEld) { var date = fIEld.parseDate(val); if(!date){ return false; } if (fIEld.startDateFIEld) { var start = Ext.getCmp(fIEld.startDateFIEld); if (!start.maxValue || (date.getTime() != start.maxValue.getTime())) { start.setMaxValue(date); start.valIDate(); } } else if (fIEld.endDateFIEld) { var end = Ext.getCmp(fIEld.endDateFIEld); if (!end.minValue || (date.getTime() != end.minValue.getTime())) { end.setMinValue(date); end.valIDate(); } } /* * Always return true since we're only using this vtype to set the * min/max allowed values (these are tested for after the vtype test) */ return true; }});Application.DashBoardForm= Ext.extend(Ext.FormPanel,{ border:false,initComponent:function() { var config = { labelWIDth: 125,frame: true,Title: 'Date Range',bodyStyle:'padding:5px 5px 0',wIDth: 350,defaults: {wIDth: 175},defaultType: 'datefIEld',items: [{ fIEldLabel: 'Start Date',name: 'fromdate',ID: 'fromdate',vtype: 'daterange',value : new Date(),endDateFIEld: 'todate' // ID of the end date fIEld },{ fIEldLabel: 'End Date',name: 'todate',ID: 'todate',startDateFIEld: 'fromdate' // ID of the start date fIEld }],buttons: [{ text: 'Go',onClick : function () { // here i want to access the value of the form fIEld // how can i access the fromdate value so that i pass it to grID console.log(this.getForm()); var win = new Ext.Window({ items:{xtype:'DashBoardGrID',fromdate:this} }); win.show(); } }] }; // eo config object // apply config Ext.apply(this,Ext.apply(this.initialConfig,config)); Application.DashBoardForm.superclass.initComponent.apply(this,arguments); } // eo function initComponent,onRender:function() { // this.store.load(); Application.DashBoardForm.superclass.onRender.apply(this,arguments); } // eo function onRender});Ext.reg('DashBoardForm',Application.DashBoardForm);
如何在onclick函数中传递date的值?
解决方法 因为你给了字段一个’fromdate’的ID,你可以使用Ext.getCmp()来引用它,并从那里调用它的getValue()方法:var fIEld = Ext.getCmp('fromdate');var win = new Ext.Window({ items: { xtype: 'DashBoardGrID',fromdate: fIEld.getValue() }});总结
以上是内存溢出为你收集整理的extjs – 如何在onclick事件中获取表单字段值全部内容,希望文章能够帮你解决extjs – 如何在onclick事件中获取表单字段值所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)