Announcement

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

    ListGridRecord setattribute error

    Hi,

    I want to set default values to the new record created in my listgrid.
    I added a roweditorhandler to the listgrid.
    In the onRowEditorEnter method of the handler class, I am trying to set the value of the field by using:

    Code:
     event.getRecord().setAttribute("fieldName", "testDefault")
    When I run my application, and start editing a new record, I get the following exception:
    Code:
    Uncaught JavaScript exception [com.google.gwt.core.client.JavaScriptException: (TypeError): Object expected
     number: -2146823281
     description: Object expected
    	at com.smartgwt.client.util.JSOHelper.setAttribute(Native Method)
    	at com.smartgwt.client.core.DataClass.setAttribute(DataClass.java:47)
    	at com.sns.crm.opportunities.client.Opportunities$11$1.onRowEditorEnter(Opportunities.java:865)
    	at com.smartgwt.client.widgets.grid.events.RowEditorEnterEvent.dispatch(RowEditorEnterEvent.java:96)
    	at com.smartgwt.client.widgets.grid.events.RowEditorEnterEvent.dispatch(RowEditorEnterEvent.java:1)
    	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
    	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    	at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)] in http://localhost:8890/com..mainmenu.MainMenu/hosted.html?com__mainmenu_MainMenu, line 9
    Any ideas on how o solve this issue or on how to set the default value for a field in a new list grid record?

    Thanks.

    #2
    Hi Halabe,
    There was actually a bug where a broken ListGridRecord instance was being returned in cases where the actual object was null. In your case, a null should have been returned when event.getRecord() is called. This has been fixed in SVN.

    Now can you provide more information on what you're trying to do along with the relevant code and program flow that leads to the onRowEditorEnter event being called?

    Note that there is a method ListGrid.startEditingNew(Map defaultValues) which you can call to create a new record with default initial values.

    Sanjiv

    Comment

    Working...
    X