Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Lifecycle of custom ExpansionComponents in ListGrid

    Hi,

    I am using SmartGWT 3.0. I have a ListGrid where I have overriden getExpansionComponent(). The current implementation will create a new Canvas each time it will be called.

    When I expand a record getExpansionComponent() will be called as expected. When I collapse it onDestroy() of the created Canvas will not be called. When I expand it again getExpansionComponent() will be called again (the created Canvas will not be reused) Due to my implementation another Canvas will be created. The old Canvas will not be destroyed at this time.

    Is there a way control the lifecycle of the canvas. I would like them to be destroyed on collapse and whenever the corresponding record will be removed from the listgrid (e.g.after data update). If not: Is it safe to save the Canvas e.g. as an attribute of the record an reuse it in the following calls of getExpansionComponent()?

    Thank you!

    #2
    You have control of the lifecycle - yes you can save the component as an attribute of the record, or in a separate Map keyed by the primaryKey or other unique value.

    Comment


      #3
      SmartGWT 3.1.p
      GWT 2.5.0
      FF18.0.2
      Chrome Version 27.0.1453.110 m

      I am using a getExpansionComponent() and each time the method is invoked either I am getting a component from the hash map by id or creating a new one.
      The issue I encountered with is that when I click on an expansion image once the component expands and becomes visible and I see in a log that the getExpansionComponent method is invoked. But the second time the component does not disappear. Sometimes I am able to do that twice but then again I am not able to collapse it.
      Has anybody saw the same behaviour an know how to make it work? Thank in advance.

      Comment

      Working...
      X