Results 1 to 4 of 4

Thread: error during phantom commit of grid record

  1. #1
    Ext User
    Join Date
    Apr 2009
    Location
    Dallas
    Posts
    22

    Default error during phantom commit of grid record

    I have a grid using a JsonReader and JsonWriter. All of my commands are working just fine (update, destroy, read), but my create functionality is causing issues.

    The function crashing is:

    Code:
        extractValues: function(data, items, len) {
            var f, values = {};
            for(var j = 0; j < len; j++){
                f = items[j];
                var v = this.ef[j](data);
                values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, data);
            }
            return values;
        },
    here is the value of my field:

    Code:
    -        f    {...}    Object
    +        [Methods]        
            allowBlank    true    Boolean
            convert    undefined    User-defined Type
            dateFormat    null    Variant
            defaultValue    ""    String
            mapping    "xrefId"    String
            name    "xrefId"    String
            sortDir    "ASC"    String
            type    "numeric"    String
    As you can see, the convert function is undefined. here is my record definition:

    Code:
        spec = Ext.data.Record.create([{
            name: 'xrefId',
            type: 'numeric',
            mapping: 'xrefId'
        },{
            name: 'sName',
            type: 'string',
            mapping: 'sName'
        },{
            name: 'gName',
            type: 'string',
            mapping: 'gName'
        }]);
    I have not defined a "convert" function for xrefId, but the documentation told me this was optional.

    here is the Json I am returning from my server's handler.
    Code:
    {success:true, xrefId: 61, specs: { xrefId: "61", sName: "specific specialty",  gName: "general specialty" }}
    This all seems to be valid, but keeps crashing at f.convert().

    After writing this, I have decided the next thing I am going to try is define xrefId as a string and see what affects this has. I will let you know the results.

    Thanks,
    Brian

  2. #2
    Ext User
    Join Date
    Apr 2009
    Location
    Dallas
    Posts
    22

    Default oops

    So, I didn't read the documentation thoroughly enough. The "type: numeric" is not a valid type. Is this new in 3.0 or am I going insane?

    I changed the xrefId field to "typetring" and it worked fine.

    I feel dumb for struggling with this for as long as I did.

    -Brian

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    If you want to treat it as a number, try 'float'

  4. #4
    Ext User
    Join Date
    Apr 2009
    Location
    Dallas
    Posts
    22

    Thumbs up

    Thanks!

    I settled with 'int' for the time being. The values are whole numbers, so I do not see any reason to use 'float' unless you there is something I don't know.

    Thanks,
    Brian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •