0

如何从 Hybris 中的自定义编辑器更新/刷新编辑器区域?

public class CustomEditor extends AbstractComponentWidgetAdapterAware implements CockpitEditorRenderer<Object> {

    @Override
    public void render(Component parent, EditorContext<Object> editorContext, EditorListener<Object> editorListener) {
        Button button = new Button("Click");
        button.addEventListener("onClick", (event) -> {
            //some logic
            //update the Editor Area after logic is done?
        });
        parent.appendChild(button);
    }
}
4

2 回答 2

1

您需要使用传递的侦听器来通知模型更改的值。例如:

public class CustomEditor extends AbstractComponentWidgetAdapterAware implements CockpitEditorRenderer<Object> {

@Override
public void render(Component parent, EditorContext<Object> editorContext, EditorListener<Object> editorListener) {
    Button button = new Button("Click");
    button.addEventListener("onClick", (event) -> {
        //some logic
        editorListener.onValueChanged(result);
    });
    parent.appendChild(button);
}

}

我希望这会有所帮助!

于 2019-09-13T07:53:41.620 回答
0

您可以为此使用小部件连接

    <widget-connection sourceWidgetId="myCustomWidget" targetWidgetId="editorArea"
             outputId="myItemType" inputId="inputObject"/>

希望能帮助到你!

于 2019-10-25T07:11:43.067 回答