Last active
May 24, 2016 17:59
-
-
Save vadimpopa/07e49e20a828c9751ce29e8e084e4ff3 to your computer and use it in GitHub Desktop.
Bind + Renderer = Quick&Easy custom Ext.form.field.Display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom display field: D01H7/74; D01H9/04 | |
xtype: 'displayfield', | |
fieldLabel: 'Custom display field', | |
bind: { | |
value: '{fooArray}' | |
}, | |
customFieldTpl: new Ext.XTemplate( | |
'<tpl for="." between="; ">', | |
'<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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, line 17 breaks the htmlEncode config.