J'essaie d'appliquer un style à une formule liée dans un ViewModel.Application du style à la formule de liaison
Mon ViewModel est:
viewModel: {
formulas: {
firstTestStoreRecord: {
bind: '{testStore}',
get: function(testStore) {
return testStore.getAt(0);
}
}
},
stores:{
testStore: {
//fields: [{ name: 'test', type: 'string' }],
data: [{
test: 'Foo',
style: {
'font-size': '22px',
'color':'red',
}
}]
}
}
},
Et ma référence à la formule est liée:
items: [{
xtype: 'form',
title: 'Bound form',
flex: 1,
items: [{
xtype: 'label',
bind: {
html: '<b>{firstTestStoreRecord.test}</b>',
bodyStyle: '{style}'
}
}]
}]
Voici un Fiddle de ce que je suis en train: Bind store from a ViewModel to an xtype label with style. J'essaye de changer le style de police dans le html, mais cela ne fonctionne PAS. J'utilise comme référence: How-to-bind-to-style-and-or-html-property
La première chose que je vois est que votre HTML est lié à 'firstTestStoreRecord.test', mais votre style est * PAS * lié à' firstTestStoreRecord.style'. – Alexander
De plus, une étiquette n'a pas 'bodyStyle', ni une config' style'. – Alexander