ucan-ext-js-kitchen-sink
Version:
my-ext-gen-app description for Ext JS app MyExtGenApp
144 lines (139 loc) • 3.06 kB
JavaScript
Ext.define('UCANSink.view.componentDetail.examples.classification.exampleViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.ucanclassificationexampleviewmodel',
data: {
hideClassifications: false,
exampleObject: {
id: 1,
classifications: [1, 2],
get: function(property) {
return this[property];
},
set: function(property, newValue) {
this[property] = newValue;
}
}
},
stores: {
availableClassificationTree: {
type: 'tree',
parentIdProperty: 'parentId',
root: {
id: 'root',
expanded: true,
leaf: false
},
data: [
{
id: 1,
categoryType: 'Kategorie 1',
name: 'Gemeine Anatomie',
key: '1',
parentId: 'root',
catalogue: {
id: 60
},
leaf: false,
categoryId: 72,
category: 'Kategorie 1'
},
{
id: 2,
key: '1.1.1',
name: 'Tag 2',
categoryType: 'Wichtig',
parentId: 1,
catalogue: {
id: 60
},
leaf: false,
categoryId: 71,
category: 'Wichtig'
},
{
id: 3,
key: '1.1.1',
name: 'Tag auch',
categoryType: 'Wichtig',
parentId: 2,
catalogue: {
id: 60
},
leaf: true,
categoryId: 70,
category: 'Unwichtig'
},
{
id: 4,
key: '1.1.2',
name: 'Tagt hier',
categoryType: 'Wichtig',
parentId: 2,
catalogue: {
id: 60
},
leaf: true,
categoryId: 70,
category: 'Unwichtig'
},
{
id: 80,
name: 'Allg. Anatomie',
categoryType: 'Allg. Anatomie',
key: '1.2',
parentId: 1,
catalogue: {
id: 60
},
leaf: false,
categoryId: 71,
category: 'Wichtig'
},
{
id: 81,
name: 'Allgemeinere Anatomie',
categoryType: 'Wichtig',
key: '1.2.1',
parentId: 80,
catalogue: {
id: 60
},
leaf: true,
categoryId: 70,
category: 'Unwichtig'
}
]
},
mandatoryCategories: {
data: [
{
id: 71,
description: 'Wichtig'
}
]
},
translation: {
data: [
{
classification: 'Klassierung',
classification_search: 'Klassierungen durchsuchen',
classifications_select: 'Klassierung auswählen'
}
]
}
},
formulas: {
translator: function(get) {
return get('translation.first');
},
extractClassification: {
bind: {
bindTo: '{exampleObject}',
deep: true
},
get: function(data) {
return data.get('classifications');
}
}
}
});