|
Re: JS - Java questions [message #1839866 is a reply to message #1839827] |
Tue, 30 March 2021 14:48 |
|
Hi Luka
If you work with Scout Classic the HeatmapField is the right place to look how custom components are done, as it is a show-case built for exactly that purpose ;-)
1. Events to JS are triggered in the JSON layer. See JsonHeatmapField / addActionEvent. Generic Property Change Events are registered in the #initJsonProperties method (for instance the PROP_VIEW_PARAMETER).
I'd recommend to stick with the UIFacade pattern used in every Scout widget, for instance the IHeatmapFieldUIFacade. It delivers additional security in case someone fiddles with your client side JS code and enables a button which should not be clickable. The UI facade would ignore the click event, because on the server side the widget is still disabled.
2. Don't use an additional jQuery library or instance. Scout already uses jQuery internally. Stick with these concepts. Every widget should only deal with the DOM controlled by the widget itself. Check HeatmapField.js#render. The element created the this.addContainer makes the this.$container property, which is a jQuery selector. Which means it provides the whole jQuery API, you can do this.$container.find('.foo'), for instance.
3. If you stick with the Scout concept there should be no need to render a property when the property has not changed. Why should you do that? The initial state of the property should be rendered in the #render function, when the value of that property changes, the renderPropertyXyz function is automatically called by the framework.
4. Implementing a Rich Text Editor means a lot of work. I've talked about this before in this thread. Basically you'd start by extending (Abstract)BasicField.
Cheers
André
Eclipse Scout Homepage | Documentation | GitHub
|
|
|
|
Re: JS - Java questions [message #1839869 is a reply to message #1839868] |
Tue, 30 March 2021 15:24 |
|
Hello Mr Robot
I don't have any experience with jQuery plugins. So I cannot say if they're ES6 compatible out of the box (which would simplify things).
I'd check if there's a NPM module for that plugin. Add the module for that plugin to your package.json and make an import for that plugin somewhere, probably in the [app].js of your UI module.
If there's no NPM module, you could put the plugin.js into the WebContent folder and request it from your index.html.
If you're stuck with that, you should probably check StackOverflow and search for "ES6 jquery", since this is a topic which is not directly related to Scout.
Hope that helps,
André
Eclipse Scout Homepage | Documentation | GitHub
[Updated on: Wed, 31 March 2021 06:27] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.05258 seconds