ucan-ext-js-kitchen-sink
Version:
my-ext-gen-app description for Ext JS app MyExtGenApp
59 lines (56 loc) • 1.03 kB
JavaScript
Ext.define('UCANSink.model.ChoiceInteraction', {
extend: 'UCANSink.model.Item',
alternateClassName: 'ChoiceInteraction',
fields: [
{
type: 'string',
name: 'question'
},
{
type: 'auto',
name: 'answerSet'
},
{
type: 'boolean',
name: 'multi'
},
{
type: 'auto',
name: 'minChoices',
defaultValue: null
},
{
type: 'auto',
name: 'maxChoices',
defaultValue: null
},
{
type: 'auto',
name: 'answers',
defaultValue: []
},
{
type: 'auto',
name: 'choices',
defaultValue: [],
convert: function(value) {
if (!Ext.isEmpty(value) ) {
return value.map(entry => entry.data ? entry.data : entry);
} else {
return [];
}
}
}
],
proxy: {
type: 'ucan-proxy',
url: 'rest/choice-interaction/',
api: {
read: 'rest/item'
},
writer: {
writeAllFields: true,
dateFormat: 'C'
}
},
});