I have the following model:
Ext.define('myApp.model.tool.SpecialModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'string'},
{name: 'loginName', type: 'string'},
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'},
],
proxy: {
type: 'rest',
url: '/special/url',
reader: {
type: 'json'
}
}
});
And this ViewModel:
Ext.define('myApp.view.support.MySpecialViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.myspecial',
stores: {
session: {
model: 'myApp.model.tool.SpecialModel'
}
}
});
And this View:
Ext.define('myApp.view.support.MySpecialView', {
extend: 'Ext.toolbar.Toolbar',
viewModel: 'myspecial',
config: {
items: [
{
xtype: 'button',
bind: '{session.lastName}',
menu: [
{
text: 'My Profile',
handler: 'onProfileClick'
}
]
}
]
},
});
At the time the view is rendered, the store is already filled. Why isn't the button showing the lastName from the specified ViewModel? When I try with inline data it works.
Thanks in advance.
Edit: When I change the button binding to the following
...
xtype: 'button',
bind: 'Hello, {session.lastName}',
menu: [
{
text: 'My Profile',
handler: 'onProfileClick'
}
]
...
not even the hardcoded string is displayed. What am I missing here?
Edit2:
Here's my json data:
{
"privileges": {
"privManageCustomer": true,
"privManageCustomerAccount": true,
},
"user": {
"accountLocked": false,
"accountLockedAt": null,
"customerId": "12123213213123",
"email": "213213",
"failedLogins": 0,
"firstName": null,
"id": "123678213621783",
"languageId": "de",
"lastFailedLogin": null,
"lastLogin": null,
"lastName": "Whatever",
"loginName": "test123"
}
}