Search code examples
comboboxextjs4extjs4.1extjs4.2extjs-mvc

Displaying spacial characters in combobox on select extjs4


I want to display special spanish characters like á,Á,ã,Ã in combobox.SO, I wrote the code for it in locale file, Inglés and Español,etc. When I open the dropdown, it displays the word correctly but when I select it, it displays the code in the box. Similar thing happens with boxLabels, it shows the code instead of the special character. Can anyone suggest me a solution for it? Thank you.

enter image description here

enter image description here

enter image description here


Solution

  • The problem occurs because elements on list are rendered as divs (so html entities works) while value box is rendered as input (entities dosen't work). Easiest way is to display national characters is to replace entities with actual unicode chars. You can do that by overriding setRawValue method:

    Ext.define('Ext.ux.form.ComboBox', {
        extend: 'Ext.form.ComboBox',
        setRawValue: function(value) {
            this.callParent([ decodeEntities(value) ]);
        }
    });
    

    Fiddle: http://jsfiddle.net/9mjbf96o/2/