Ext.define('erp.view.core.button.ExportSMT',{ extend: 'Ext.Button', alias: 'widget.erpExportSMTButton', iconCls: 'x-button-icon-excel', cls: 'x-btn-gray', id:'exportSMT', text: $I18N.common.button.erpExportSMTButton, style: { marginLeft: '10px' }, width: 70, initComponent : function(){ this.callParent(arguments); }, handler:function(){ var grid = Ext.getCmp('grid'); var form = Ext.getCmp('form'); console.log(form.title); var key = Ext.getCmp(form.keyField).value; if(grid && key > 0) { window.location = basePath + 'pm/mes/exportSMT.xls?caller=ProductSmt!Import'+ '&title=' + (form.title.replace(/»/g, '/') + '&id=' + key); } } });