Page 1 of 2 12 LastLast
Results 1 to 10 of 11

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

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Answers
    6
    Vote Rating
    2
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Answers
    6
    Vote Rating
    2
      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
      0  

    Default

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

  5. #5
    Ext JS Premium Member canxss's Avatar
    Join Date
    Sep 2008
    Posts
    190
    Answers
    1
    Vote Rating
    3
      0  

    Default

    Hi,

    I've upgraded from Sencha Touch 2.4.1 to 2.4.2 and our clients started to get this error on mobile Chrome, Safari and Android browsers.

    Code:
    Layout/default.js
    
        removeInnerItem: function(item) {
            item.element.detach();
        },
    It's been a long time but I think this error may have been fixed and re-occurred again.

    Thanks in advance

  6. #6
    Sencha Premium Member
    Join Date
    Dec 2009
    Posts
    23
    Answers
    3
    Vote Rating
    2
      0  

    Default

    I'm also having this issue. Occurs randomly when popping navigation views. You could also reproduce it by popping a navigation view multiple times after each other without a delay in between it.Anybody @Sencha with a proper solution to this? Adding a delay between popping is an option, but it also occurs randomly when not popping too fast.Thanks!

  7. #7
    Sencha User
    Join Date
    May 2013
    Posts
    31
    Vote Rating
    2
      0  

    Default

    Hello, did you find the solution or the root cause?

    Sencha guys, please help to understand and clarify a right use of POP and ways to handle view transitions... We have added a piece of code that send us an error report whenever an error ocurred in the App and we are getting A LOT of detach errors from our customers!! we cant control the speed they pop views, this should be basic.

    Please clarify since Ive seen several threads about this.

    regards, Gustavo

  8. #8
    Sencha Premium Member
    Join Date
    Dec 2009
    Posts
    23
    Answers
    3
    Vote Rating
    2
      0  

    Default

    Hi, I think we tried to avoid this problem by adding a delay between multiple pops or a combination of pop and push. Didn't solve the actual cause of it though.

  9. #9
    Sencha User
    Join Date
    May 2013
    Posts
    31
    Vote Rating
    2
      0  

    Default

    Hello MDB, thans for your reply.

    It is sad to force the framework to be slower... we usually see this error on android devices, iphone and ipad are really fast and that should be the difference.

    We should start reviewing our Apps and make them slower when push and pop... but it is a straight attack to the UX, I think this should be addressed in the Sencha core logic, to prevent this, skip the animations or do something safe when doing something so simple like pop and push...

    Thans again for your comment, we will try to patch this in your way in the meantime.

    Quote Originally Posted by mdb View Post
    Hi, I think we tried to avoid this problem by adding a delay between multiple pops or a combination of pop and push. Didn't solve the actual cause of it though.

  10. #10
    Sencha User
    Join Date
    May 2013
    Posts
    31
    Vote Rating
    2
      0  

    Default

    Hello Mitchel...

    It seems the problem is when sencha core tries to apply multiple animations and when destroy issues are involved...

    We are just using push and pop and usually get this when the phone is not the fastest one... Is there any way to hack sencha code to prevent errors when animating multiple times?
    I really dont care if the user miss one or two animations, but this is crashing the apps which is unacceptable...

    By slowing down the push and pop process is a solution Ive seen in the forum, but how much time should I delay? we dont want our app to be a turtle, but we dont know the animations lenght on each phone...

    Do you have any safe ways to deal with this issue? thanks a lot!

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •