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

    CanvasItem.storeValue is not a function


    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: Caused by: (TypeError) : self_0_g$.storeValue is not a function TypeError: self_0_g$.storeValue is not a function
        at E3r_g$.N_m_g$ [as storeValue_2_g$] (
        at E3r_g$.z8r_g$ [as lambda$2_33_g$] (
        at A8r_g$.L5r_g$ [as onClick_2_g$] (
        at xwm_g$.Awm_g$ [as dispatch_140_g$] (
        at xwm_g$.zwm_g$ [as dispatch_1_g$] (
        at xwm_g$.pnc_g$ [as dispatch_0_g$] (
        at zxc_g$ (
        at _xc_g$.Kxc_g$ [as doFire_0_g$] (
        at _xc_g$.Qxc_g$ [as fireEvent_1_g$] (
        at oxc_g$.rxc_g$ [as fireEvent_0_g$] (
        at Z_k_g$.Fgd_g$ [as fireEvent_0_g$] (
        at $Q_g$ (
        at bR_g$ (
        at (

    I am using smartgwt 12.0-p20200130.

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

    Thank you.

    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.


      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.


        Make sure you've set shouldSaveValue - see the docs