Announcement

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

    [BUG] ListGridField with value-aware CanvasItem throws Exception in storeValue

    Hello,

    I'm using smartgwt LGPL 3.1p 20130530 (nightly).
    When using a custom CanvasItem, which stores its value via CanvasItem::storeValue(), I get the following error after changing the value of the item:

    Code:
    Uncaught exception escaped : com.google.gwt.event.shared.UmbrellaException
    Exception caught: Exception caught: (TypeError) @com.smartgwt.client.widgets.form.fields.CanvasItem::storeValue(Ljava/lang/Object;)([string: '4567897']): self.storeValue is not a function
    this is the code for reproducing the error:

    Code:
    public void onModuleLoad() {
    	ListGrid lg = new ListGrid();
    	lg.setWidth100();
    	lg.setHeight100();
    	lg.setEditorCustomizer(new ListGridEditorCustomizer() {
    		@Override
    		public FormItem getEditor(ListGridEditorContext context) {
    			if ("foo".equals(context.getEditField().getName())) {
    				return new CanvasItem() {
    					{
    						setShouldSaveValue(true);
    						TextArea input = new TextArea();
    						setCanvas(new WidgetCanvas(input));
    						input.addValueChangeHandler(new ValueChangeHandler<String>() {
    							@Override
    							public void onValueChange(ValueChangeEvent<String> event) {
    								// self.storeValue is not a function
    								storeValue(event.getValue());
    							}
    						});
    					}
    				};
    			}
    			return context.getDefaultProperties();
    		}
    	});
    	lg.setFields(new ListGridField("foo"), new ListGridField("bar"));
    	lg.startEditingNew();
    	lg.setCanEdit(true);
    	lg.draw();
    }
    regards
    Andreas
    Last edited by andy.2003; 30 May 2013, 23:48. Reason: adding LGPL to the version, typos

    #2
    Like DataSourceField.setEditorType(), returning a FormItem via this customizer has special rules - you need to get the CanvasItem instance from the event rather than relying on the one that's implicitly in scope as "this".

    Comment


      #3
      Originally posted by Isomorphic View Post
      Like DataSourceField.setEditorType(), returning a FormItem via this customizer has special rules - you need to get the CanvasItem instance from the event rather than relying on the one that's implicitly in scope as "this".
      Hello, there is no event with an attached CanvasItem. Can you give an example of what you mean.

      Comment

      Working...
      X