`

Ext.Panel 加载页面刷新 跳转问题

阅读更多

Ext.Panel 加载页面刷新 跳转问题

困扰我好久的问题终于解决了。上次开发项目我好不容易用EXTJS搭建出来一个漂亮的框架界面,但是在mainfram容器中刷新页面的时候,出现了问题,页面直接跳转到另一个新的区域,控制不住了。

今天难得空闲终于解决了。就这么简单:

new Ext.Panel({
                      id:'maintab',
          title:config.myitems[i].title,
          tbar:new Ext.Toolbar({
           items:['-']
           }),
          //autoLoad :{url:config.myitems[i].url,params:config.myitems[i].params,scripts:true},
          html:' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="'+config.myitems[i].url+'"> </iframe>',
          autoScroll:true,
          closable:true,
          layout:'fit'
          }

把原来的autoLoad换成html就行了。

原因如此下:

引用地址:http://topic.csdn.net/u/20080721/16/403d81b4-245f-419d-9772-e0dba28bc1e0.html

具体解决如下:
autoLoad这个属性不要,换成html:' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="'+url+'"> </iframe>',
那个url是传过来的连接,可以是一个页面也可以是一条参数,如a.jsp或者user.do?o=toList,这样就可以直接把你要的页面加载进来,而且你对加载进来的页面进行操作是不是更新整个页面的,而只是更新你加载进来的页面。通过 <iframe>这个元素加载网页进来的好处是比autoLoad多的,例如你autoLoad加载进来的页面要想加载进来的页面实现javascript就要在autoLoad里加多个javascripts:true属性,然后如果你是用autoLoad加载进来的页面,样式表是被禁用的,但你通过 <iframe>加载进来的页面就可以实现样式表,我当时就因为这个问题迷惑了很久,希望我的经验对楼主有帮助~

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics