Home Forums FlexGantt Refreshing the data/model underlying the gantt chart

  • Author
    Posts
  • Brian
    Participant
    Post count: 21
    #12832 |

    Is there an elegant way to swap out the data (rows and timeline object) underlying a ganttChart?
    In our use case, we are loading a set of data that matches a certain time window. If the user wants to see more, they would expand the horizon. We have a listener in place to catch that event. At that point, we need to go back to the database to query for a fresh set of data. I was thinking the best approach is to clear out the data entirely and refill it with the new set.
    I was hoping to avoid having to rebuild the ganttChart from scratch which would mean we would have to reconfigure it and likely lose any view the user had on the screen.
    There are methods to remove the timeline objects, but I need to go one step farther.
    I tried setModel(new DefaultGanttChartModel, ITimelineObject>(new DefaultGanttChartNode<>())), which I was hoping would be a good approach, but so far, no luck.
    Would appreciate some pointers on the right approach to this.

  • Dirk Lemmermann
    Keymaster
    Post count: 61
    #12839 |

    Yes, there is no need to recreate the entire Gantt chart control. Setting a new model on the Gantt chart should be sufficient. Try explicitly calling LayerContainer.repaint().

  • Brian
    Participant
    Post count: 21
    #12860 |

    I can only guess that I was thinking that clearing the model was not working because I had another problem I had soooo many. Clearing the model makes sense and works. Blasting the whole gantt chart from inside a listener didn’t make much logical sense anyhow, since you would effectively blast the object that you were associated with. Guess that closes this request.

  • Dirk Lemmermann
    Keymaster
    Post count: 61
    #12861 |

    OK, glad to hear that this is resolved.

You must be logged in to reply to this topic.