Announcement

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

    RecordList length() and first() caused an exception

    RecordList length() and first() caused an exception

    On a DynamicForm object I call the method getRecordList. If I try to use the RecordList returned from this method call I get the following exception.

    Uncaught exception escaped : com.google.gwt.event.shared.UmbrellaException
    Exception caught: (TypeError) @com.smartgwt.client.data.RecordList::getLength()([]): self.getLength is not a function
    See the Development console log for details.
    Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling.
    There are no messages in the Development console when this happens.

    Here is the code I'm using:

    Code:
    DynamicForm uploadForm = Forms.UPLOAD_CONTACT_LIST.getForm();
    RecordList records = uploadForm.getRecordList();
    // Record record = uploadForm.getRecordList().first();
    Either of the last two lines of code will cause an exception.

    #2
    The DynamicForm only allows editing / display of a single record at a time and as such the "getRecordList" API - which retrieves a list of "live" records being displayed in a dataBound component such as a ListGrid - is essentially inapplicable and returning a bad data object.

    We'll look into how best to modify the framework code to avoid this confusion and resolve this issue. However you should modify your application code - getRecord() will return you the record being edited by the form, and if you need this in a RecordList format within your application for some reason, you can create your own RecordList and add the record to it.

    Regards
    Isomorphic Software

    ===
    Edit: A quick follow up to note that we have now modified the framework so you should not have this problem with this method going forward. getRecordList() will now return a RecordList with a single entry containing the DynamicForm's current record.
    Last edited by Isomorphic; 23 Apr 2013, 10:15.

    Comment


      #3
      Originally posted by Isomorphic View Post

      We'll look into how best to modify the framework code to avoid this confusion and resolve this issue. However you should modify your application code - getRecord() will return you the record being edited by the form
      What version is this fix in or will be in?

      I couldn't seem to use the getRecord method for a DynamicForm. It's not documented in the DynamicForm JavaDoc nor will it compile for me. Is there another way to call the getRecord method from an object that a DynamicForm contains?

      Thanks for your help.

      Comment


        #4
        Use getValuesAsRecord(). There's no fix, this API has been there a long time.

        Comment

        Working...
        X