Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » why does the document.getElementById(this._id) return null?(help to create custom widget)
why does the document.getElementById(this._id) return null? [message #768628] Tue, 20 December 2011 13:50 Go to next message
David Song is currently offline David SongFriend
Messages: 217
Registered: April 2011
Senior Member
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
Re: why does the document.getElementById(this._id) return null? [message #1426242 is a reply to message #768628] Thu, 18 September 2014 13:02 Go to previous message
Alexandru LATAFriend
Messages: 8
Registered: October 2013
Junior Member
Hi David,

Can you tell me if you managed to create your widget for fusioncharts? I would appreciate if you can give me some hints or maybe a code snippet.

Best regards,
Alex
Previous Topic:Use 1.5 M2 RA theme in 1.5 M4
Next Topic:Theming a subclass of Button
Goto Forum:
  


Current Time: Thu Mar 28 08:46:48 GMT 2024

Powered by FUDForum. Page generated in 0.02937 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top