View Full Version : error during phantom commit of grid record

17 Jul 2009, 7:28 AM
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:

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:

- 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:

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.

{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.


17 Jul 2009, 7:33 AM
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 "type:string" and it worked fine.

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


17 Jul 2009, 12:30 PM
If you want to treat it as a number, try 'float'

20 Jul 2009, 5:35 AM

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.