1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    7
    Vote Rating
    0
    Elkmor is on a distinguished road

      0  

    Thumbs up [2.0a1] ComboBox + html

    [2.0a1] ComboBox + html


    I'll be short.

    Html tags work perfectly in dropped down combobox list, but when choosen html tags shown instead of formatting. Should I provide some kind of renderer, or this is a bug?

    Code:
        prioritiesStore = new Ext.data.SimpleStore({
            data:[
                [10, 'По вдохновению'],
                [30, 'Не срочно'],
                [50, 'В ближайшее время'],
                [70, 'Первоочередная'],
                [90, '<b>Немедленно</b>']
            ],
            fields: ['value', 'html'],
            id: 0
        });
    
                            new Ext.form.ComboBox({
                                id: 'ed-priority',
                                anchor: '100%',
                                fieldLabel: 'Приоритет',
                                store: prioritiesStore,
                                valueField: 'value',
                                displayField: 'html',
                                mode: 'local',
                                editable: false,
                                triggerAction: 'all'
                            })
    Attached Images

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Interesting. I believe this thing was designed for string data that doesn't contain HTML Elements. I think the html tags are not being escaped in the drop down list, which is why you're seeing the text formatting. However, the box is a generic input box, thus HTML = plain text. i don't think this is a bug at all, but bad practice.

  3. #3
    Ext User
    Join Date
    Jun 2007
    Posts
    16
    Vote Rating
    0
    lechuck is on a distinguished road

      0  

    Default


    I thinks thats is normal. Because the list is layers based HTML, and the selected item is a text input. The combobox functionality is a layer for the list, text input for the selected item and hidden input for the transformed select. Well, i assume this functionality, using Firefox source code generated.

    You can not write html into a text field, well you can, but the input does interpret it like text plain.

  4. #4
    cuteleaf
    Guest

    Default


    i met the same problems.
    how to solve?

  5. #5
    Sencha User
    Join Date
    Jul 2007
    Location
    Moscow, Russia
    Posts
    295
    Vote Rating
    0
    6epcepk is on a distinguished road

      0  

    Default


    any ideas to solve this problem? ext 3.

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Try something like:
    Code:
    var store = new Ext.data.SimpleStore({
    	id: '0',
    	fields: ['value', 'display', 'html'],
    	data: [
    		[0, 'Red', '<span style="color: red;">Red</span>'],
    		[1, 'Green', '<span style="color: green;">Green</span>'],
    		[2, 'Blue', '<span style="color: blue;">Blue</span>']
    	]
    });
    var combobox = new Ext.data.ComboBox({
    	store: store,
    	mode: 'local',
    	valueField: 'value',
    	displayField: 'display',
    	tpl: '<tpl for="."><div class="x-combo-list-item">{html}</div></tpl>',
    	triggerAction: 'all',
    	editable: false
    });
    (use separate fields for the text in the input and the one in the drowdown list)

  7. #7
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    The problem is that you can't display rendered HTML in an input field!

  8. #8
    Sencha User
    Join Date
    Jul 2007
    Location
    Moscow, Russia
    Posts
    295
    Vote Rating
    0
    6epcepk is on a distinguished road

      0  

    Default


    Condor, cheating solution, but its single way... thanks :-)

    jgarcia@tdg-i.com, yep =(