小应用100828(Format ComboBox Items)

Format ComboBox Items

This tutorial will show how to create a simple combobox which displays image items in the drop down panel. You can use the formatter function on combobox to tell it how to format each of its items.

<input id="cc" type="text">

$('#cc').combobox({
    url:'combobox_data.json',
    valueField:'id',
    textField:'text',
    formatter:function(row){
        return '<img class="item-img" src="'+row.icon+'"/><div class="item-text">'+row.text+'</div>';
    }
});



As you can see above, the formatter function takes one parameter named 'row' and return the formatted item value.


http://jquery-easyui.wikidot.com/tutorial:form4

你可能感兴趣的:(jquery,json)