Skip to content

Instantly share code, notes, and snippets.

@vadimpopa
Last active May 24, 2016 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vadimpopa/07e49e20a828c9751ce29e8e084e4ff3 to your computer and use it in GitHub Desktop.
Save vadimpopa/07e49e20a828c9751ce29e8e084e4ff3 to your computer and use it in GitHub Desktop.
Bind + Renderer = Quick&Easy custom Ext.form.field.Display
// Custom display field: D01H7/74; D01H9/04
xtype: 'displayfield',
fieldLabel: 'Custom display field',
bind: {
value: '{fooArray}'
},
customFieldTpl: new Ext.XTemplate(
'<tpl for="." between=";&nbsp;">',
'<span class="search-field-link" data-value="{xindex}"' ,
' style="{[values.invention === "YES" ? "font-weight: bold;" : ""]}">{name}</span>',
'</tpl>'
),
renderer: function (value, field) {
var html = field.customFieldTpl.apply(value);
return field.htmlEncode ? Ext.util.Format.htmlEncode(html) : html;
}
@mitchellsimoens
Copy link

FYI, line 17 breaks the htmlEncode config.

@vadimpopa
Copy link
Author

@mitchellsimoens thanks, fixed that.

@mitchellsimoens
Copy link

Very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment