Hi,
This question is related to LoadableDetachable Model.
I have a wicket panel, LearningCurveChartPanel.
*public* LearningCurveChartPanel(String aId, IModel<AnnotatorState>
aModel)
{
*super*(aId);
model = aModel;
//initially the chart is empty. passing empty model
chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*,
LoadableDetachableModel.*of*(*this*::renderChart));
chartPanel.setOutputMarkupId(*true*);
add(chartPanel);
}
@OnEvent
*public* *void* onRenderAnnotations(RenderAnnotationsEvent aEvent)
{
LOG.trace("rendered annotation event");
aEvent.getRequestHandler().add(*this*);
}
which is rendering a ChartPanel. The ChartPanel is like this
*public* ChartPanel(String aId, LoadableDetachableModel<LearningCurve>
loadableDetachableModel)
{
*super*(aId);
chartModel = (loadableDetachableModel);
chart = *new* WebMarkupContainer(*MID_CHART_CONTAINER*);
chart.setMarkupId("canvas");
chart.setOutputMarkupId(*true*);
add(chart);
chartAjaxBejavior = *new* ChartAjaxBejavior();
add(chartAjaxBejavior);
}
The chartModel has the right data and it renders correctly with the data
that is fed to it from LearningCurveChartPanel.
But when the onRenderAnnotation event of the LearningCurveChartPanel
triggers what I am trying to do is to update the (re-render) the Chart
Panel inside it. It does re-render the chart panel but the model stays the
same. I want to implement it such that the model of the ChartPanel updates
and when it re-renders it as the latest data when the onRenderAnnotation
event was triggered.
Please guide me in the right direction.
Best,
Sibgha