Defining our models

Our Project, Task, and TaskLog models were created with basic fields using Sencha Cmd in Chapter 9, Getting Started with Ext JS 4, but they lacked in persistence or validation logic. It is now time to add the required code.

The TaskLog Model

The TaskLog model is the most complicated model in our application. The complete TaskLog model with all required logic is as follows:

Ext.define('TTT.model.TaskLog', {
    extend: 'Ext.data.Model',    
    fields: [
        { name: 'idTaskLog', type: 'int', useNull:true },
        { name: 'taskDescription', type: 'string' },
        { name: 'taskLogDate', type: 'date', dateFormat:'Ymd' }, { name: 'taskMinutes', type: 'int' }, { name: 'hours', type: 'float', persist:false, convert:function(value, record){ return record.get('taskMinutes') ...

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.