ExtJS neutron page calls the parent page elements felt

       In the most recent period get ExtJS-related projects, found himself for JavaScript stuff is really lacking a lot of things, so felt writing this record, I hope to help a bit, ^ V ^.

       In the ExtJS often use TabPanel example, while TabPanel in a mosaic of a Panel JSP or sub-pages Html, etc., but sometimes we need on a sub-page on the parent page

TabPanel certain operations, such as adding a TabPanel Panel, this requires TabPanel objects we can get the parent page in the sub-page, or in the parent page has been written in

Panel method of adding to TabPanel.

       Subpages Needless to say, in general is the way to use window.parent.XXX or window.parent.XXX () Gets the parent page object or method (Note: XXX represents the parent page

Object or method), as the following code (sub-page is the addTab function, goto parent page is the function):

      


   
1 function addTab(url,proName,proId){
2 url = " projectInfo.jsp?projectId= " + url;
3 window.parent.goto(url, " 项目概况 " ,proName,proId, ' 4 ' );
4 };

       Occasionally we use window.parent.goto () method can not get, which is why, the problem in a JS of a scope, due to the use of a parent page ExtJS often used Ext.onReady () method often it will be defined in this method, such as:

      


   
1 Ext.onReady( function (){
2 function goto(){
3 XXXXXXXXXX....
4 }
5 var centerPanel = Ext.TabPanel();
6 })

      This place is in the goto and centerPanel, also in this scope inside, not global in Ext.onReady area, so we can not access the sub-pages, it is to be accessed, the methods and objects will

Ext.onReady to put out. For some this global approach, sub-pages of useful objects, we are set to Global in the parent page, for ease of use.

Reproduced in: https: //my.oschina.net/cjkall/blog/195881

Guess you like

Origin blog.csdn.net/weixin_33704234/article/details/91756587