PDA

View Full Version : [OPEN] Tag field shows item close buttons even when read only



Dhugal
31 Jul 2015, 12:42 AM
https://fiddle.sencha.com/#fiddle/ree

(https://fiddle.sencha.com/#fiddle/ree)Steps to repo:

1) Run the fiddle.
2) Notice that the 2nd tag field, which is read only, still shows the "close" X buttons for the items even though they cannot be removed.

Workaround - replace the multiSelectItemTpl to only show the button on items if they field is not read only (as shown in workaround in the fiddle).




multiSelectItemTpl = new Ext.XTemplate([
'<tpl for=".">',
'<li data-selectionIndex="{[xindex - 1]}" data-recordId="{internalId}" class="' + me.tagItemCls + childElCls,
'<tpl if="this.isSelected(values)">',
' ' + me.tagSelectedCls,
'</tpl>',
'{%',
'values = values.data;',
'%}',
me.tipTpl ? '" data-qtip="{[this.getTip(values)]}">' : '">',
'<div class="' + me.tagItemTextCls + ' {cls}">{[this.getItemLabel(values)]}</div>',
'<tpl if="!this.isReadOnly()">',
'<div class="' + me.tagItemCloseCls + childElCls + '"></div>',
'</tpl>',
'</li>',
'</tpl>',
{
isSelected: function (rec) {
return me.selectionModel.isSelected(rec);
},
getItemLabel: function (values) {
return Ext.String.htmlEncode(me.labelTpl.apply(values));
},
getTip: function (values) {
return Ext.String.htmlEncode(me.tipTpl.apply(values));
},
isReadOnly: function () {
return me.readOnly;
},
strict: true
}
]);
}

tristan.lee
31 Jul 2015, 12:44 PM
Thanks for reporting this. Since the read-only behavior functions as documented, I've created an improvement request for this to give the option to hide the trigger icon.

Dhugal
2 Aug 2015, 12:55 PM
Great thanks Lee - just to be clear though this is not the trigger icon, it's the close icon on each item in the field.