wangxiao71892 2015-06-30 04:46 采纳率: 0%
浏览 1661

extjs 4.2 点击事件tab 时 不能显示grid 的问题

 ![图片说明](https://img-ask.csdn.net/upload/201506/30/1435639352_775795.jpg)

 在var  grid 这行 提示有错 Uncaught TypeError: Cannot read property 'dom' of null     求组织给看下,刚接触extjs  搞了好几天了总是不显示。。
  • 写回答

1条回答 默认 最新

  • wangxiao71892 2015-06-30 04:50
    关注

    <br> Ext.onReady(function () {<br> var tab=Ext.createWidget(&#39;tabpanel&#39;, {<br> renderTo: &quot;divb&quot;,<br> activeTab: 0, //指定默认的活动tab 1表示第二个tab是默认激活的<br> width: 600,<br> height: 550,<br> plain: true, //True表示tab候选栏上没有背景图片(默认为false)<br> enableTabScroll: true, //选项卡过多时,允许滚动<br> defaults: { autoScroll: true },<br> items: [{<br> id: &quot;tab1&quot;,<br> title: &#39;普通Tab&#39;,<br> html: &quot;这只是一个非常普通的Tab。&quot;,<br> items:[{xtype:&#39;button&#39;,text:&#39;按钮&#39;}],<br> closable: true //这个tab可以被关闭<br> }, {<br> id: &quot;tab4&quot;,<br> title: &#39;事件Tab&#39;,<br> closable:true,<br> items:[grid]<br> // listeners: { activate: function(){<br> // tab.add(grid);<br> // tab.doLayout();<br> // tab.setActiveTab(aa);<br> // } }<br> }]<br> });</p> <pre><code> Ext.create(&#39;Ext.data.Store&#39;, { storeId: &#39;simpsonsStore&#39;, fields: [&#39;name&#39;, &#39;email&#39;, &#39;phone&#39;], data: { &#39;items&#39;: [{ &#39;name&#39;: &#39;Lisa&#39;, &quot;email&quot;: &quot;lisa@simpsons.com&quot;, &quot;phone&quot;: &quot;555-111-1224&quot; }, { &#39;name&#39;: &#39;Bart&#39;, &quot;email&quot;: &quot;bart@simpsons.com&quot;, &quot;phone&quot;: &quot;555-222-1234&quot; }, { &#39;name&#39;: &#39;Homer&#39;, &quot;email&quot;: &quot;home@simpsons.com&quot;, &quot;phone&quot;: &quot;555-222-1244&quot; }, { &#39;name&#39;: &#39;Marge&#39;, &quot;email&quot;: &quot;marge@simpsons.com&quot;, &quot;phone&quot;: &quot;555-222-1254&quot; }] }, proxy: { type: &#39;memory&#39;, reader: { type: &#39;json&#39;, root: &#39;items&#39; } } }); var cm=[{ text: &#39;Name&#39;, dataIndex: &#39;name&#39; }, { text: &#39;Email&#39;, dataIndex: &#39;email&#39;, flex: 1 }, { text: &#39;Phone&#39;, dataIndex: &#39;phone&#39; }]; var grid= Ext.create(&#39;Ext.grid.GridPanel&#39;, { loadMask: true, title: &#39;Simpsons&#39;, id:&#39;aa&#39;, store: Ext.data.StoreManager.lookup(&#39;simpsonsStore&#39;), colModel:cm, height: 200, width: 500, tbar: [{ //这里开始 xtype: &#39;toolbar&#39;, dock: &#39;top&#39;, items: [{ xtype: &#39;textfield&#39;, id: &#39;gid&#39;, name: &#39;findstr&#39;, maxLength: 10, labelWidth: 35, width: 120, fieldLabel: &#39;Name&#39; }, { xtype: &#39;textfield&#39;, id: &#39;gname&#39;, name: &#39;findstr&#39;, maxLength: 10, labelWidth: 35, fieldLabel: &#39;Phone&#39; }] }, { xtype: &#39;toolbar&#39;, dock: &#39;top&#39;, items: [&#39;-&gt;&#39;, { xtype: &#39;button&#39;, text: &#39;查询&#39;, handler: function () { } }, { xtype: &#39;button&#39;, text: &#39;重置&#39;, handler: function () { } }] }], renderTo:&#39;tab4&#39; }); }); &lt;/script&gt;![图片说明](https://img-ask.csdn.net/upload/201506/30/1435639817_188867.jpg) </code></pre>

    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图2.0 版本点聚合中Marker的位置无法实时更新,如何解决呢?
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题