1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Answers
    6
    Vote Rating
    2
    azamatoak is on a distinguished road

      0  

    Default Unanswered: item.element.detach null error when going back in navigationview

    Unanswered: item.element.detach null error when going back in navigationview


    I am getting an error from time to time when a view is popped from the navigationview that it is contained and the previous is shown. In between this process, I am seeing this error in the console:

    TypeError: 'null' is not an object (evaluating 'item.element.detach') at Default.js:151

    What could this be? And, more importantly how do I find the cause of this?

    Update: After looking around trying to replicate this error, here's what I've found. When I try to call item.destory() on the navigationview.pop() method to remove the unused view that has been deactivated is when I see the error above. The issues is that the view that I'm trying to remove is not a container, but rather a list. See code below:

    Code:
    Ext.define('MyApp.view.settings.HelpList', {
    	extend: 'Ext.dataview.List',
    	xtype: 'helpListView',
    
    
    	config: {
    		disableSelection: true,
            onItemDisclosure: true,
            flex: 1,
    		ui: 'round',
    		store: 'faqs',
    		cls: "faq-list",
    		itemTpl: '<div class="faq-question">{faq_question}</div>'
    	}
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Are you calling view.destroy() when you pop? If so don't, the navigation view should by default destroy the view for you being popped.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Answers
    6
    Vote Rating
    2
    azamatoak is on a distinguished road

      0  

    Default


    I have completely removed the oldView.destroy() calls from pop() method of navigationview(s). ST2 does indeed autoDestroy by default. However, I am still seeing this error from time to time as well as the following error:

    TypeError: 'undefined' is not an object (evaluating 'this.middleElement.dom') Rounded.js:61

    I am guessing the above is related to list elements and rounding the first/last item.

    Any other reasons I could be seeing the detach error?

    TypeError: 'null' is not an object (evaluating 'item.element.detach') Default.js:151

    This happens across all 3 platforms, iOS, Android and BlackBerry 10

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    0
    Hudell is on a distinguished road

      0  

    Default


    Did you ever manage to fix this? I'm having the same problem.