Ext 核心 API -- Ext.getCmp

getCmp( String id ) : Component

通过id得到一个Component对象

<mce:script type="text/javascript"><!-- function InitDialog() { // 生名组件 new Ext.Panel({ renderTo:"hello-dialog", id:"hello-dialog", title:"面板头部header", width:300, height:200, html:'<h1>面板主区域</h1>', tbar:[{text:'顶部工具栏topToolbar'}], bbar:[{text:'底部工具栏bottomToolbar'}], buttons:[{text:"按钮位于footer"}] }); } function Show() { var dialog = Ext.getCmp("hello-dialog"); // 根据ID获取组件 dialog.show(); // 得到组件后,就可以对他想干什么就干什么了 } function Hide() { var dialog = Ext.getCmp("hello-dialog"); dialog.hide(); } Ext.onReady(InitDialog); // --></mce:script>

<button onclick="Hide();">Hidde</button> <button onclick="Show();">Show</button> <div id="hello-dialog"> </div>

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lmstone/archive/2008/09/25/2979106.aspx

你可能感兴趣的:(function,api,ext,header,dialog,button)