Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

jQuery EasyUI Form - Format Drop-Down Box (ComboBox)


May 09, 2021 jQuery EasyUI


Table of contents


jQuery EasyUI Form - Format the pull-down box

This section describes how to format the jQuery EasyUI drop-down box (Combobox).

The following example shows you how to create a simple pull-down box that shows picture items in the pull-down box. You can use the formatter function on the pull-down box to tell it how to format each entry.

jQuery EasyUI Form - Format Drop-Down Box (ComboBox)

Create an image drop-down box (Combobox)

	<input id="cc" style="width:100px" 
                url="data/combobox_data.json" 
                valueField="id" textField="text">
	</input>
	$('#cc').combobox({
		formatter:function(row){
			var imageFile = 'images/' + row.icon;
			return '<img class="item-img" src="'+imageFile+'"/><span class="item-text">'+row.text+'</span>';
		}
	});

Download the jQuery EasyUI instance

jeasyui-form-form4.zip