Picker menu Popup problem

Hi all, was wondering anybody can help me figure out the workaround for this problem.

1. click on the button creates an enyo page that has a picker. click on the picker to return back to App().
2. click again the button to go back to the page with a picker. the picker popup fails this time.

http://jsfiddle.net/BJHGN/3/

Comments

  • When you call renderInto(documentBody), you blow away any DOM nodes that have been generated by the app. In this case, you've destroyed the enyo.floatingLayer DOM node that's used to show popups, but that control doesn't know that it's been destroyed.

    I modified your fiddle as http://jsfiddle.net/BJHGN/4/ to a version that works. However, it's generally a bad idea to keep creating new objects and rendering them into a div without destroying the old objects first, so I'd look into a different application structure that kept your app object alive for the whole program.
  • is there a way to trigger floatinglayer to destroy since i know when the page exit.

    I tried the method u suggested in jsfiddle, but now i bumped into that container div not behaving like a real document.body ...like fit no longer calc the actual height of body when resized in triggered.

    i figured out since im porting only to android / ios, i will fallback to enyo.select for by next week.
  • edited March 2013
    Try modifying enyo.FloatingLayer -- in the beforeChildRender method, add these lines
    if (this.hasNode() && !this.node.parentNode) {
        this.teardownRender();
    }
    to the top and see if that works. The idea is to detect the case where the node's parent (document.body) has been wiped out and regenerate. Let me know if this is good and I'll add it for 2.3.
  • Thanks, i'll try implementing it first thing in the morning
  • implementation didnt work
  • OK, looks like a change is needed in Popup.js's render() too. I'll look at this later tonight.
  • OK, I figured out a simpler fix -- the updated kind is shown in http://jsfiddle.net/BJHGN/6/. I just added a hasNode() override for FloatingLayer. I'll update the code base ASAP.
  • thanks ben.
    tested it single popup from picker - works
    popup from controls loaded from kind - works

    so far so good :)
  • edited April 2013
    Hi Ben,

    I am having kind of similar issue for the onyx.picker control.
    I destroy the picker clientcontrols and create the component again.
    First time the menu displays correctly but second time onwards whenever I create the component the menu items are not displaying inside the picker.
    (If I keep floating false then menu works fine but it does have other issues for me with floating false).
    I am using panels. On tap of item from first panel I create the second panel inside which I show the picker. If i click again on that item then I destroy the panel and recreate the panel and create the picker components.

    I tried replacing my floatinglayer.js with your code from the jsfiddle but it does not work for me.

    Do we need any other changes apart from this..
  • This sounds like a different bug. I'd need a reproduction to tell more about what's going on for you.
  • Ben, I got another problem also related to this one, the popup is fixed now, but scrim (scrim:true on a popup) now dies on me.
Sign In or Register to comment.