Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Custom Control(Need a div element child of a custom control)
Custom Control [message #549721] Tue, 27 July 2010 17:00 Go to next message
Jesus   Luna Quiroga is currently offline Jesus Luna Quiroga
Messages: 63
Registered: July 2009
Location: Mexico
Member

Hi, I'm creating a custom control wrapping a control from YUI, but this control needs a div element.

<div id="calContainer"></div>
var c = new YAHOO.widget.Calendar("calContainer", configOptions);

I don't know how to create a div that is child of my custom control in qooxdoo, the only way I can create it is with the document object:

document.createElement( "div" );

But this places the control outside the application's frame.

Can you help me creating this div in order to be a child of my custom control?
Re: Custom Control [message #549743 is a reply to message #549721] Tue, 27 July 2010 19:18 Go to previous messageGo to next message
Philipp Eichhorn is currently offline Philipp Eichhorn
Messages: 8
Registered: December 2009
Junior Member
Hi Jesus,

I believe this simple skeleton should do the trick, although there are probably better solutions involving qooxdoo API:

qx.Class.define("custom.widget.dummy", {
    extend: qx.ui.layout.CanvasLayout,
    
    construct: function(id) {
        this.base(arguments);
        this.setHtmlAttribute("id", id);
        this.__id = id;

        // ...
    },

    // ...

    members : {
        load : function () {        	        	
            qx.ui.core.Widget.flushGlobalQueues();
            var element = document.getElementById(this.__id);
            // create DIV
            document.createElement("YOUR_DIV");
            // append it as a child
            element.appendChild(document);
            // ...
        }

        // ...
    }	
}


Just pass the widget id in your LCA, when creating the widget:

String id = WidgetUtil.getId(widget);
writer.newWidget("custom.widget.dummy", new Object[] { id });

[Updated on: Tue, 27 July 2010 19:23]

Report message to a moderator

Re: Custom Control [message #549747 is a reply to message #549743] Tue, 27 July 2010 19:27 Go to previous messageGo to next message
Philipp Eichhorn is currently offline Philipp Eichhorn
Messages: 8
Registered: December 2009
Junior Member
Thinking about it, if you only want to wrap the calendar, even this would be enough:
var element = document.getElementById(this.__id);
var c = new YAHOO.widget.Calendar(element, configOptions);
Re: Custom Control [message #549791 is a reply to message #549721] Tue, 27 July 2010 23:57 Go to previous message
Jesus   Luna Quiroga is currently offline Jesus Luna Quiroga
Messages: 63
Registered: July 2009
Location: Mexico
Member

That worked fine, thanks!
Previous Topic:the view turned into blank
Next Topic:Where is common used Color symbolic name defined?
Goto Forum:
  


Current Time: Tue Sep 23 22:31:56 GMT 2014

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

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