EXTJS4---Cannot read property ' Addcls ' of NULL

Source: Internet
Author: User

Use EXTJS4 MVC to do the background management system, by clicking on the left navigation menu to tabpanel add tab, and then close and then open a tab, results TabPanel cannot display tab, the System page is in a crash state, and the browser error cannot read property ' Addcls ' of NULL.

        The analysis of the online data, the reason is: the definition of the grid when the line to add the code: new  ext.grid.rownumberer (). If there is no such code, the system is functioning normally.

< Span style= "Font-family:consolas,courier new,courier,mono,serif" >    When creating a window,panel with ExtJS, or a new rownumberer Such a component, When window is closed, it will also destroy the components that it contains internally, so that when you create the window for the second time, the internal reference component has been destroyed and the error has occurred.

< Span style= "Font-family:consolas,courier new,courier,mono,serif" >         But if you get the component in this form {xtype: ' xxx '}, the internal components are recreated every time that create, and no errors are generated. So the recommendation is to keep {xtype: ' in the internal items] xxx '} form defines subcomponents, but this gird ordinal function is temporarily not {xtype: ' xxx '} This way gets the component, It can only be created through create.


The error code:

Ext.define (' WEB.view.stage.slide.SlideGridView ', {extend: ' Ext.grid.Panel ', alias: ' Widget.slidegridview ', Striperows:true,    loadmask:true,    seltype: ' Checkboxmodel ', Columnlines:true,    store: ' Slidestore ',    Columns:[ext.create (' Ext.grid.RowNumberer ', {text: ' ordinal ', width:40,align: ' Center '}), {sortable:false, width:250, Align: ' left ', dataindex: ' Bgimgurl ', text: ' Background image '},{sortable:false, width:250, align: ' left ', dataindex: ' Desimgurl ', Text: ' Description picture '},{sortable:false, Flex:1,    align: ' left ', dataindex: ' Slidehref ', text: ' Sliding link '},  {dataindex: ' SlideID ', text: ' Sliding id ', hidden:true},],dockeditems: [{     xtype: ' Pagingtoolbar ',     store: ' Slidestore ',     dock : "Bottom",    enableoverflow:true,    displayinfo:true,    emptymsg: ' No data ',    displaymsg: ' Current display {0}-{1} Record/Total {2} records ', Beforepagetext: ', '      afterpagetext: ' page/Total {0} page '}]});
Modify the correct code:

Ext.define (' WEB.view.stage.slide.SlideGridView ', {extend: ' Ext.grid.Panel ', alias: ' Widget.slidegridview ', Initcomponent:function () {ext.apply (this,{striperows:true, Loadmask:true, SelType: ' Checkboxmodel ', ColumnLines: True, store: ' Slidestore ', columns:[ext.create (' Ext.grid.RowNumberer ', {text: ' ordinal ', width:40,align: ' Center '}), {sort Able:false, width:250, align: ' left ', dataindex: ' Bgimgurl ', text: ' Background image '},{sortable:false, width:250, align: ' left ', Dataindex: ' Desimgurl ', text: ' Description picture '},{sortable:false, flex:1, align: ' left ', dataindex: ' Slidehref ', text: ' Sliding link '}, { Dataindex: ' SlideID ', text: ' Sliding id ', hidden:true},],dockeditems: [{xtype: ' Pagingtoolbar ', store: ' Slidestore ', do CK: "Bottom", Enableoverflow:true, Displayinfo:true, emptymsg: ' No Data ', Displaymsg: ' Current display {0}-{1} bar Record/Total {2} Records '          , Beforepagetext: ' First ', Afterpagetext: ' page/Total {0} page '}]}); This.callparent (arguments); }});


So all of the properties of the settings must be set in the Apply method, if not put in the apply inside will be reported:uncaught typeerror:cannot Read property ' parentnode ' of undefined error.

EXTJS4---Cannot read property ' Addcls ' of NULL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.