html - Applying style to binding formula -




i'm trying apply style bound formula in viewmodel.

my viewmodel is:

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',                             }                         }]                     }                 }             }, 

and reference bound formula is:

items: [{                 xtype: 'form',                 title: 'bound form',                 flex: 1,                 items: [{                     xtype: 'label',                     bind: {                         html: '<b>{firstteststorerecord.test}</b>',                         bodystyle: '{style}'                     }                 }]             }] 

here fiddle of trying: bind store viewmodel xtype label style. trying change font style in html, not working. using reference: how-to-bind-to-style-and-or-html-property

there 2 things wrong:

  • a label not have style, let alone bodystyle config. if want style, have use inline html on label or take container.
  • your binding of style not against record (firstteststorerecord).

corrected , working code:

items: [{     xtype: 'container',     bind: {         html: '<b>{firstteststorerecord.test}</b>',         style: '{firstteststorerecord.style}'     } }] 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -