You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we have table field name as "id" which is a primary key, we will have to mention a dummy name(not a field in table) as idProperty of model and clientIdProperty as "id". The issue is that default idProperty of model is "id" which will always have value like this "ext-record-x". If mentioned config options are not specified in model, id value in table will be like ext-record-1,2,3. But we expect it as integer.
Example
Ext.define("Contacts", {
extend: "Ext.data.Model",
config : {
idProperty : 'uniqueid', // if we have field with name as id, conflicts happens with default idProperty(id) which always have value as ext-record-x
clientIdProperty : 'id',
fields: [{
name: 'firstName',
type: 'string'
}, {
name: 'lastName',
type: 'string'
},{
name: 'id',
type: 'int',
fieldOption: 'PRIMARY KEY'
}, {
name: 'modifyDate',
type: 'string'
}, {
name: 'modifyDateParsed',
type: 'string',
mapping: 'modifyDate', // not working
isTableField: false,//newly implemented to distinguish field
convert: function(value, rec) {
var dt = Ext.Date.parseDate(rec.get('modifyDate'), "Y-m-d H:i:s")
newval = Ext.Date.format(dt,'M j, Y, g:i a')
return newval;
}
}],
proxy: {
type: 'sqlitestorage',
dbConfig: {
tablename: 'contacts_tables',
dbConn: Ext.DbConnection.dbConn
},
reader: {
type: 'array'
}
}
},
writer: {
type: 'array'
}
});
The text was updated successfully, but these errors were encountered:
You can use identifier config in the model for set the way sencha generate the ids of the store
....
config: {
identifier: {
type: 'sequential',
prefix: ''
},
.....
}
If we have table field name as "id" which is a primary key, we will have to mention a dummy name(not a field in table) as idProperty of model and clientIdProperty as "id". The issue is that default idProperty of model is "id" which will always have value like this "ext-record-x". If mentioned config options are not specified in model, id value in table will be like ext-record-1,2,3. But we expect it as integer.
Example
Ext.define("Contacts", {
extend: "Ext.data.Model",
The text was updated successfully, but these errors were encountered: