Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Touch Premium Member
    Join Date
    Apr 2011
    Location
    Cary, NC
    Posts
    135
    Answers
    5
    Vote Rating
    0
    ChrisWalker is on a distinguished road

      0  

    Default Unanswered: Removing an ext.Chart from a Carousel

    Unanswered: Removing an ext.Chart from a Carousel


    I have a Carousel Component that contains an Ext.ext.chart. This particular Carousel can be resized and when I resize it I need to redraw the chart to fit in its new size. Currently I am removing the chart component from the carousel with the destroy flag = true and then creating another chart and inserting it into the Carousel. This works just fine on Chrome Windows/Mac Safari Windows/Mac and the IOS Ipad simulator. Unfortunately it crashes on an iPad (IOS 4.3.3) consistently. When I comment out the chart component adding/deleting the web app does not crash on the iPad.

    I suspect this is a memory issue so my question is -
    Is this the best way to cleanly remove and destroy a chart Component?
    Code:
     chartComponent = Ext.ComponentQuery.query('#' + chartID);
    
    
        if (chartComponent.length > 0)
        {
             currentActiveItemIndex = thisChartPanelCarousel.getActiveIndex();
             thisChartPanelCarousel.remove(chartComponent[0],true);
        }

  2. #2
    Touch Premium Member
    Join Date
    Apr 2011
    Location
    Cary, NC
    Posts
    135
    Answers
    5
    Vote Rating
    0
    ChrisWalker is on a distinguished road

      0  

    Default


    It turns out I was making this harder than needed to be.
    If I just set the width and height of the Carousel, the chart card in the Carousel resizes as well and no longer crashes Safari on the iPad!

    Nice!

    Resize the panel that contains the Carousel:
    Code:
    // The mainPanelEle contains the width and height that I want chartPanel to be resized to
          chartPanel.setSize(mainPanelEle.getWidth(), mainPanelEle.getHeight());
    After the chartPanel has been resized, Setting the Carousel's height and width will cause a resize event to take place and will cause the chart to be redrawn. Be sure to use a setSize(w,h) as opposed to using setWidth() and setHeight(). Each of those statements will cause a resize event so it will force the chart to be drawn twice rather than once with the setSize()

    Code:
    // get the height of the titlebar in this panel
        titlePanel = chartPanel.items.get(0);
        h = chartPanel.getHeight() - titlePanel.getHeight();
        w = chartPanel.getWidth();
    
    
    thisChartPanelCarousel.setSize(w,h);

Tags for this Thread