Posted 13 July 2018, 10:05 am EST - Updated 3 October 2022, 11:27 am EST
I have a MultiAutoComplete control, In the item list I want to show the user image and name, so I set isContentHtml = true, and I set the displayMemberPath to my custom html property, the item list looks good, but when I select an item, the selected item only shows the name, not the image.
Searching in the souce code I comment the following line, and now selected item look good.
// insert token into template
MultiAutoComplete.prototype._insertToken = function (item) {
var tokenTxt = this._getItemText(item, true); // TFS 253890
if (this.isContentHtml) {
if (!this._cvt) {
this._cvt = document.createElement('div');
}
this._cvt.innerHTML = tokenTxt;
//this line does the trick
//tokenTxt = this._cvt.textContent.trim();
}
else {
tokenTxt = wijmo.escapeHtml(tokenTxt);
}
this._wjTpl.insertBefore(this._createItem(tokenTxt), this._wjInput);
};
Why is this behavior by default? Why isn’t there and option like itemContentHtml=true?