Compass.ErpApp.Widgets.DynamicGrid = { addWidget:function(){ Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror('<%= render_widget :dynamic_grid %>'); } } Compass.ErpApp.Widgets.AvailableWidgets.push({ name:'Dynamic Grid', iconUrl:'/images/icons/document_text/grid_48x48.png', onClick:Compass.ErpApp.Widgets.DynamicGrid.addWidget, about:'What my new widget is about' });