Hi all,
I want to create a custom widget, and the widget class has only one property and I invoke the method document.getElementById(this._id) in javascript, but got null, and can not find the dom element, but if I add an alert before it, after clicking the alert button and the method get a value. how to get the element without the alert ?
in rap view:
Bar2D bar = new Bar2D(parent, SWT.FILL);
bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
bar.setChartData("bar");
in javascript code:
properties : {
chartData : {
init : "",
apply : "initChart"
}
},
members : {
_doActivate : function() {
var shell = null;
var parent = this.getParent();
while( shell == null && parent != null ) {
if( parent.classname == "org.eclipse.swt.widgets.Shell" ) {
shell = parent;
}
parent = parent.getParent();
}
if( shell != null ) {
shell.setActiveChild( this );
}
},
initChart : function() {
if(this.getChartData()){
var chartId = "fms"+Math.ceil(Math.random()*10000);
var chart = new FusionCharts("/resources/Area2D.swf?id=" + Math.random(), chartId , "100%", "100%", 0, 1);
chart.setJSONData(this.getChartData());
chart.render(this._id);
}
}
}
thanks a lot
David