I'm trying to add jquery sparkline to a listgrid. The challenge is that sparkline function must be called when new data is rendered. There's seem to be an elegant solution in smartclient world as outlined here http://forums.smartclient.com/showthread.php?p=17032 but how can I observe grid.body redraw event in SmartGWT world? Overriding ListGrid.redraw() doesn't work.
Announcement
Collapse
No announcement yet.
X
-
it works!
Turns out that solution can be the same. Just add a native function to your grid class:
Code:public native void addSparklines()/*-{ var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()(); var body = self.body; if (body == null) return; self.observe(body, "redraw", "jQuery('.sparklines').sparkline('html',{ type:'bar', barColor:'green' });"); body.redraw(); }-*/;
Code:grid.addDrawHandler(new DrawHandler() { @Override public void onDraw(DrawEvent event) { grid.addSparklines(); } });
Comment