javascript - Custom Wicket (Ajax) Control with complex data model -
we giving wicket (v8) try project, , wondering what's best practice following scenario:
- we have database library function returns
list<complexobject>. - the call being handled within
imodel - we want render d3 visualization backed model, let's call
complexvisualization. - the model needs rendered javascript variable (as json), such our d3 code can use input.
- the user can make changes in other controls such database library call generate different
list<complexobject> - when complexvisualization added ajax target javascript variable need update value accordingly, , custom javascript method needs triggered such can refresh d3 visualization.
i looking code example point out class complexvisualization should extend from, how render html component (if necessary), , how have 1 javascript variable in sync imodel<list<complexobject>>.
thanks & suggestions,
daniel
complexvisualization may have method tojson() serializes json. in addition may have method update() returns string like: "window.updatevisualization(" + tojson() +")". way should use target.appendjavascript(complexvisualization.update()).
the javascript method updatevisualization should defined javascriptheaderitem contribution, e.g. in my-lib.js.
Comments
Post a Comment