Jump to content

How to change font of TunimComboxBox List Item and Select?


newsanti

Recommended Posts

  with UnimComboBox1 do
    ClientEvents.UniEvents.Values['beforeInit'] :=
      'function beforeInit(sender, config) {'+
      '    config.listConfig = {'+
      '    tpl: new Ext.XTemplate('+
      '    ''<tpl for=".">'+
      '     <div class="x-boundlist-item" style="{[this.check(values)]}"'+
      '     >{val}</div></tpl>'''+
      '     ,{ disableFormats: true,'+
      '        check: function(values) {'+
      '               return "font-family: Noto Serif Thai;"'+
      '        }'+   //end..check
      '      }'+
      '    )'+      //end..XTemplate
      '    }'+      //end..listconfig
      '}';          //end..beforeInit

Not Work.

https://fiddle.sencha.com/#fiddle/1bpq&view/editor

Ext.application({
    name : 'Fiddle',
    
    launch : function() {
        // The data store containing the list of states
        var states = Ext.create('Ext.data.Store', {
            fields: ['abbr', 'name'],
            data : [
                {"abbr":"AL", "name":"Alabama"},
                {"abbr":"AK", "name":"Alaska"},
                {"abbr":"AZ", "name":"Arizona"}
            ]
        });
        
        // Create the combo box, attached to the states data store
        Ext.create('Ext.form.ComboBox', {
            fieldLabel: 'Choose State',
            store: states,
            queryMode: 'local',
            displayField: 'name',
            valueField: 'abbr',
            renderTo: Ext.getBody(),
            // Mark records with abbr: "AL" with red color
            tpl: '<tpl for=".">' +
            '<div class="x-boundlist-item" style="font-family: Noto Serif Thai;" >{name}</div>' +
            '</tpl>'
        });
    }
});

Mobile Combobox.zip

Link to comment
Share on other sites

@newsanti

ItemList:

procedure TMainmForm.UnimFormCreate(Sender: TObject);
begin
  with UnimComboBox1 do
    JSInterface.JSConfig('itemTpl', ['<span class="x-list-label" style="color:green; font-size:14px; font-style: italic;">{val:htmlEncode}</span>']);
end;

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...