EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: patana on August 02, 2013, 12:32:46 PM



Title: decode html entity in combobox
Post by: patana on August 02, 2013, 12:32:46 PM
In combobox, i have few values contained the entity reference in it. Can we decode it ?
(http://www.jeasyui.com/forum/index.php?action=dlattach;topic=2014.0;attach=399;image)


Title: Re: decode html entity in combobox
Post by: stworthy on August 03, 2013, 07:53:15 AM
Please show your test code to demonstrate your issue.


Title: Re: decode html entity in combobox
Post by: patana on August 03, 2013, 09:40:06 AM
<select class="easyui-combobox" name="state" style="width:200px;">
     <option value="AL">Alabam&a</option>
     <option value="AK">Alaska</option>
     <option value="AZ">Arizona</option>
</select>

When i choose "Alabam&a", i want it to show as "Alabam&a".


Title: Re: decode html entity in combobox
Post by: stworthy on August 03, 2013, 06:33:11 PM
Please override the $.fn.combobox.parseData function to solve your issue.
Code:
	$.fn.combobox.parseData = function(target){
var data = [];
var opts = $(target).combobox('options');
$(target).children('option').each(function(){
var item = {};
item[opts.valueField] = $(this).attr('value')!=undefined ? $(this).attr('value') : $(this).text();
item[opts.textField] = $(this).text();
item['selected'] = $(this).attr('selected');
data.push(item);
});
return data;
};


Title: Re: decode html entity in combobox
Post by: patana on August 16, 2013, 09:35:20 AM
Thanks!! It works..