Ich versuche, einen Stil auf eine gebundene Formel in einem ViewModel anzuwenden.Anwenden von Stil auf die Bindungsformel
Mein Ansichtsmodell ist:
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',
}
}]
}
}
},
Und mein Hinweis auf die gebundene Formel ist:
items: [{
xtype: 'form',
title: 'Bound form',
flex: 1,
items: [{
xtype: 'label',
bind: {
html: '<b>{firstTestStoreRecord.test}</b>',
bodyStyle: '{style}'
}
}]
}]
Hier ist eine Fiddle von dem, was ich versuche: Bind store from a ViewModel to an xtype label with style. Ich versuche, den Schriftstil im HTML zu ändern, aber es funktioniert NICHT. Ich verwende diese als Referenz: How-to-bind-to-style-and-or-html-property
Das erste, was ich sehe, ist, dass Ihre HTML zu 'firstTestStoreRecord.test' gebunden ist, aber Ihre Art ist * NICHT * gebunden' firstTestStoreRecord.style'. – Alexander
Plus, ein Label hat keinen 'bodyStyle', noch hat es eine' style' Konfiguration. – Alexander