Models and persistence
Ext JS 4 models are similar to JPA entities in that they define data fields that represent columns in the underlying database tables. Each model instance represents a row in the table. The primary key field is defined using the idProperty
of the model, which must match one of the field names. The User
model can now be updated as shown:
Ext.define('TTT.model.User', {
extend: 'Ext.data.Model',
fields: [
{ name: 'username', type: 'string' },
{ name: 'firstName', type: 'string' },
{ name: 'lastName', type: 'string' },
{ name: 'fullName', type: 'string' },
{ name: 'email', type: 'string' },
{ name: 'password', type: 'string' },
{ name: 'adminRole', type: 'string' }
],
idProperty: 'username'
});
Defining the proxy
Each model can ...
Get Enterprise Application Development with Ext JS and Spring now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.