Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » ColorField.js(Creating new field)
ColorField.js [message #1849878] Mon, 07 February 2022 08:22
Mr Robot is currently offline Mr RobotFriend
Messages: 69
Registered: March 2020
Hello, currently learning JS part of Eclipse Scout.

I want to create ColorField. But I have problem that value is always null. Can you help me.

This is ColorField.js, extending BasicField with input type = color
import { BasicField } from '@eclipse-scout/core';

export default class ColorField extends BasicField {

	constructor() {

	_init(model) {

	_render() {
		this.addContainer(this.$parent, 'colorfield');

		let $field = this.$parent.makeElement('<input>', 'color-field')
			.attr('type', 'color')
			.attr('autocomplete', 'NoAutocomplete') /* off and false are currently ignored in Chrome */



This is ColorFieldAdapter:
import { BasicFieldAdapter } from '@eclipse-scout/core';

export default class ColorFieldAdapter extends BasicFieldAdapter {

	constructor() {


This is JsonColorField.js
public class JsonColorField<T extends IColorField> extends JsonBasicField<T> {

	public JsonColorField(T model, IUiSession uiSession, String id, IJsonAdapter<?> parent) {
		super(model, uiSession, id, parent);

	public String getObjectType() {
		return "myapp.ColorField";


I also imported ColorField and ColorFieldAdapter in index.js

This is IColorField
public interface IColorField extends IBasicField<String> {


This is AbstractColorField:
public class AbstractColorField extends AbstractBasicField<String> implements IColorField {
	private IBasicFieldUIFacade m_uiFacade;

	public AbstractColorField() {

	public AbstractColorField(boolean callInitializer) {

	protected void initConfig() {
		m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(new P_UIFacade(), ModelContext.copyCurrent());

	public IBasicFieldUIFacade getUIFacade() {
		return m_uiFacade;


Now, every time I got null when doing getColorField().getValue();

When I inspect field in JS field has value when color is changed in picker. Inspecting field I see attribute value with right color like '#rit94d'

Do I need to setValue from JS?

I also tried:

I also tried catch events (change, input) and set value and also set init value but I cannot get value in Java.

Thank you
Previous Topic:Eclipse Scout new project forcing to 22-beta
Next Topic:22.0-beta1: Classic App not loading after successful login
Goto Forum:

Current Time: Sat Mar 02 13:41:09 GMT 2024

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

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

Back to the top