PDA

View Full Version : a way to alert convertion failure?



dedoz
10 Mar 2012, 6:51 PM
this is related to data / models
also to the useNull data/ Field config

when a reader fails to convert a value it sets that field to 0 or null (if useNull its true).

looking at data/Type who converts the values, i didnt see any way that this could trigger something on a failure, is just converts the value or used a null / 0

example source of int convertion (from data / type source code)


INT: {
convert: function(v) {
return v !== undefined && v !== null && v !== '' ?
parseInt(String(v).replace(Ext.data.Types.stripRe, ''), 10) : (this.useNull ? null : 0);
},
sortType: st.none,
type: 'int'
},


so is there a way to detect ,when loading data or manually given data, couldnt be converted? like an event or something ? or cant be detected and fails silent ?

(sorry for my english)

mitchellsimoens
11 Mar 2012, 6:53 AM
You can specify your own convert method on the field.