Skip to Content
author's profile photo Former Member
Former Member

WidgetInstanceManager null during pre-initialize

I need to modify some widget setting during per-initialize function of my custom widget controller. So that, it can be reflected when my widget loads. However i am not able to do that because uptil pre-initialze , the WidgetInstanceManager has not been set yet. It comes out to be null.

In initialize function however, I get the WidgetInstanceManager , but it is of no use to me here because any setting or model set here will not be reflected on widget.

I have extended DefaultWidgetCOntroller undoubtedly.

this seems a little weird since all the documentation suggests that we can set model and widgetsettings during pre-initialize

I want to ask if there is some function which can be called so that I have WidgetInstanceManager during per-initialize.


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Oct 03, 2016 at 07:41 AM

    Hi Anjali,

    widgetInstanceManager definitely shouldn't be null. I did quick test, and widgetInstanceManager wasn't null and value was set correctly:

         public void preInitialize(@SuppressWarnings("unused") final Component comp)
             setValue("minAutosuggestionsQueryLength", 6);

    Perhaps it's problem with your controller registration?

    Nevertheless, you don't need to override preInitialize method in order to change defeult settings. You can just override it in YOUR_EXTENSION-backoffice-widgets.xml. For example:

      <widget-extension widgetId="hmc2list">
          <setting key="multiSelect" value="TRUE" type="Boolean" />



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Lukasz,

      So the issue was that I didn't add controller entry in definition.xml of the widget. This was leading to widgetInstanceManager as null.

      I cannot configure settings in widget.xml file because I need to change the setting based on an internal value. That's why I need pre initialize function.

      Thanks for the help :)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.