The data layer
When writing the prototype, I did partially build the data classes that were required, so now let's fully flesh them out:
// packages/wizard/src/model/Questionnaire.js Ext.define('Wizard.model.Questionnaire', { extend: 'Ext.data.Model', fields: [ { name: 'title' }, { name: 'introduction' }, { name: 'conclusion' } ], proxy: { type: 'rest', url: 'http://localhost:3000/questionnaire' }, toJSON: function() { return this.getData(true); } });
Standard stuff here with one exception is that a toJSON
method that consumes applications can override in order to obtain JSON in a format they can use for further processing. The default implementation returns the data of the questionnaire object along with its association data. Alternatively, they can override the proxy configuration to save the questionnaire data to their own server.
Let's take a look at the model I used to represent a step in the questionnaire:
//...