Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » [Javascript] Set custom parent of element created with scout.create()?(I want to use Scout form elements in custom non-Scout DOM elements)
[Javascript] Set custom parent of element created with scout.create()? [message #1773337] Tue, 26 September 2017 14:41 Go to next message
Marius Tippkämper is currently offline Marius TippkämperFriend
Messages: 2
Registered: July 2017
Junior Member
Hey everybody,

I'm generating Scout form fields on the client side via Javascripts scout.create(), in this case a StringField.

var stringField = scout.create('scout.StringField', {
  parent: scout.sessions[0].desktop,
  labelVisible: true,
  name: "test",
  value: "testing"
});


As you can see the field is appended to the desktop DOM element. But what we want to do is instead append to a custom, Javascript generated child element of the desktop.

Is that in any way possible without breaking everything?

Thanks for your help,
Marius
Re: [Javascript] Set custom parent of element created with scout.create()? [message #1773664 is a reply to message #1773337] Mon, 02 October 2017 14:22 Go to previous message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi Marius,

you can use any widget as parent. What you need to take care of is the layouting.

Example: Let's assume you want to put the string field on the bottom of the desktop navigation (on the bottom left of the screen). In that case you would use the navigation (desktop.navigation) as parent and you would have to adjust the DesktopNavigationLayout to tell where the string field should be positioned exactly. In order to do this, you could extend scout.DesktopNavigation, override the function _render, do a super call and set a custom layout for the navigation.

scout.CustomDesktopNavigation.prototype._render = function() {
  scout.CustomDesktopNavigation.parent.prototype._render.call(this);
  
  this.htmlComp.setLayout(new scout.CustomDesktopNavigationLayout(this));
};

Previous Topic:Scout 7.0 user.area preference
Next Topic:Apache - Tomcat forwarding does not work with a scout application
Goto Forum:
  


Current Time: Thu Apr 25 18:52:13 GMT 2024

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

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

Back to the top