PDA

View Full Version : Ext.data.Field and convert



vadimv
24 Dec 2012, 8:45 AM
I noticed that convert method for fields is called twice: first at 'record.setData' then at 'record.save'. Is impossible to use convert in the cases when there is a convert formula like below, because when second call is made then convert returns a new, wrong value


convert: function(v,record){
return md5([record.get('aname'), v].join(':')); // or just without md5.
}


Could be here an workaround, or other approach, besides the manual convert, don't know yet, but at first look seems a framework problem.

Comments & suggestions are welcomed.
Thx.

mitchellsimoens
26 Dec 2012, 8:11 AM
When you say at record.save when you first execute it or when the request is returned by the server?

vadimv
26 Dec 2012, 9:40 AM
I did not look at it, was in a hurry, even if I was interested about the answer too. I suppose is after the server response/ or in my case after websql save

vadimv
26 Dec 2012, 10:03 AM
ok, took me 2 minutes to check that Ext.data.Operation has 'updateRecord' which is called on each successful operation, and in it I see that currentRecord.set(recordData) updates record data and calls convert functions, as I supposed, obviously won't work when having above convert formulas