It seems to me that the links config of the viewModel is not behaving like expected. I'm building my app in architect. This small example that I've made is written below, it does not work. It says it can't find a model called 'User'. Using the full path: 'FormViewModel.model.User' does also not work. I've done exactly like the docs say.
Links config viewModel does not work.
I don't know how to make these loose files work in Sencha Fiddle. Sencha Fiddle has an app.js. I don't seem to have an app.js in my architect project.
Code:
Ext.define('FormViewModel.view.MyPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.mypanel',
requires: [
'FormViewModel.view.MyPanelViewModel',
'Ext.form.field.Text'
],
viewModel: {
type: 'mypanel'
},
session: true,
height: 250,
width: 400,
title: 'My Panel',
items: [
{
xtype: 'textfield',
fieldLabel: 'Name',
bind: {
value: '{theUser.name}'
}
},
{
xtype: 'textfield',
fieldLabel: 'PhoneNumber',
bind: {
value: '{theUser.phonenumber}'
}
}
]
});
Code:
Ext.define('FormViewModel.view.MyPanelViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.mypanel',
requires: [
'Ext.data.Store',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],
links: {
theUser: {
type: 'User'
id: 2
}
},
stores: {
Users: {
model: 'FormViewModel.model.User',
proxy: {
type: 'ajax',
url: '/resources/users.json',
reader: {
type: 'json',
rootProperty: 'root'
}
}
}
}
});
Code:
Ext.define('FormViewModel.model.User', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.Field'
],
fields: [
{
name: 'id'
},
{
name: 'name'
},
{
name: 'phoneNumber'
}
]
});
Code:
{root: [{
id: 1,
name: "Mitchell",
phoneNumber: "ABC4526"
}, {
id: 2,
name: "Simoens",
phoneNumber: "ABC4526"
}, {
id: 3,
name: "Is",
phoneNumber: "ABC4526"
}, {
id: 4,
name: "God",
phoneNumber: "ABC4526"
}]
}
Links config viewModel does not work.
Aucun commentaire:
Enregistrer un commentaire