Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    CanvasItem.storeValue is not a function

    Hello,

    I am trying to use a custom CanvasItem in a ListGrid to handle complex value (the editor is actually a popup window with Ok/Cancel buttons created through a FormItemInitHandler).
    I want to trigger EditCompleteEvent when I click on Ok button, in order to handle save management in related ListGrid.

    After reading several page of forum on CanvasItem/ListGrid (as integration is not so intuitive) , I tried to invoke CanvasItem.storeValue(String) or CanvasItem.storeValue(Record)..
    All results in following exception:

    Code:
    ConsoleLogger.java:55 Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) : self_0_g$.storeValue is not a function
    ConsoleLogger.java:32 TypeError: self_0_g$.storeValue is not a function
        at E3r_g$.N_m_g$ [as storeValue_2_g$] (CanvasItem.java:950)
        at E3r_g$.z8r_g$ [as lambda$2_33_g$] (ValueEditorItem.java:133)
        at A8r_g$.L5r_g$ [as onClick_2_g$] (ValueEditorItem.java:129)
        at xwm_g$.Awm_g$ [as dispatch_140_g$] (ClickEvent.java:124)
        at xwm_g$.zwm_g$ [as dispatch_1_g$] (ClickEvent.java:123)
        at xwm_g$.pnc_g$ [as dispatch_0_g$] (GwtEvent.java:76)
        at zxc_g$ (EventBus.java:40)
        at _xc_g$.Kxc_g$ [as doFire_0_g$] (SimpleEventBus.java:193)
        at _xc_g$.Qxc_g$ [as fireEvent_1_g$] (SimpleEventBus.java:88)
        at oxc_g$.rxc_g$ [as fireEvent_0_g$] (HandlerManager.java:127)
        at Z_k_g$.Fgd_g$ [as fireEvent_0_g$] (Widget.java:129)
        at Canvas.java:7755
        at $Q_g$ (Impl.java:239)
        at bR_g$ (Impl.java:291)
        at Impl.java:77
        at _3.click (Canvas.java:7766)

    I am using smartgwt 12.0-p20200130.

    Any clue on the reason of this exception, and how to trigger EditCompleteEvent properly ?

    Thank you.

    #2
    We can't do much with an obfuscated stack trace - please read the Debugging overview to understand how to get better diagnostic information, and how to report possible problems.

    The only thing we can guess from this is that you might be creating a CanvasItem, passing it as an item to a DynamicForm, then trying to call methods on that item. You can't do that, the CanvasItem you pass is just for configuration. You need to retrieve the live item in any event handling code, from the event or via form.getItem().

    If you look at the various samples for CanvasItem, or even just the samples for forms and FormItems in general, you'll see that all of the example code does this. Also, generally if you make this mistake, you will see logs in your Developer Console telling you that you have made this mistake.

    Comment


      #3
      Thank you very much for the hint.
      I was indeed trying to invoke storeValue() directly on the "config" object. Using the FormItem from appropriate context prevent the exception, but still not save the value.
      However, I will investigate a little further with Dev Console to see how I can properly save the value, and will provide more details in case I still have questions.

      Comment


        #4
        Make sure you've set shouldSaveValue - see the docs

        Comment

        Working...
        X