In sencha touch 2, it appears there are only string, int, float, boolean data types. How then do I store a datetimes?
UPDATE
OK, I found I can use convert() to convert values: http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Types
convert: Function A function to convert raw data values from a data
block into the data to be stored in the Field. The function is passed
the collowing parameters:
– v : Mixed
The data value as read by the
Reader, if undefined will use the configured defaultValue.
– rec : Mixed
The data object containing the row as read by the Reader. Depending on
the Reader type, this could be an Array (ArrayReader), an object
(JsonReader), or an XML element.
// Add a new Field data type which stores a VELatLong object in the Record.
Ext.data.Types.VELATLONG = {
convert: function(v, data) {
return new VELatLong(data.lat, data.long);
},
sortType: function(v) {
return v.Latitude; // When sorting, order by latitude
},
type: 'VELatLong'
};
But I do not really understand the code. For convert(), what sets the parameters? Why is the 1st param unused and when and what is it used for? How do I get/set such custom types (does it become v or data in convert())?
Sencha Touch 1.0supports date type in Model.However,
Sencha Touch 2only supports only 4 data types for Model.What you can do is you can put your
dateinStringformat and then later on convert it intodateobject using the API’s.