Re: Instance of a Tabview breaking within Instance of a Panel during panel refre
- You're correct,
I don't know why I didn't think of that.
I'll just create the tabview once, and then switch out the source divs
with ajax, and that should eliminate the problem.
> Try adding the TabView instantiation code as part of your success
> callback when you get new investor details -OR- remove the existing
> "demo" TabView DIV before sending out the AJAX request.
> Since you're blowing away the markup for the TabView every time you
> click on a row, you will need to recreate a new instance every time.
> You should also consider purging any event listeners before destroying
> the markup (see the Event Utility API Docs).
> The root of the problem is probably the fact that you're trying to
> instantiate the TabView, right after you dispatch the async request*
> onclick = callAJAX(); new TabView();
> So, TabView is potentially instantiated before the markup for it is
> inserted into the document by the AJAX request.
> This works the first time, because the "demo" div doesn't exist. TabView
> waits for it internally, using onAvailable to wrap up instantiation.
> The second time, since "demo" exists already, the TabView instance gets
> created right away, but is then replaced by the new markup which comes
> in after it.
> Ideally, you can look into formatting your async request response, using
> JSON for example, so that you can reuse the same TabView instance and
> simply switch out its contents and labels.
> - Satyen
> * NOTE: Even with your undefined check, I believe you're still creating
> a new instance of the TabView every time, since the investor_1,
> investor_2 variables you're checking for are not global - you can add
> some debugging code to verify this.