This is a migrated thread and some comments may be shown as answers.

[Solved] Feature Request: ComboBox item image icons & custom css

2 Answers 118 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Fern
Top achievements
Rank 1
Fern asked on 12 Jan 2011, 12:56 AM
great product!

For the developers..
 
it would be great if you can add the ability to set a custom icon for the items on a Combo Box similar to what you can do to set image icons on Menus.

Thanks

2 Answers, 1 is accepted

Sort by
0
Gerard Eikelboom
Top achievements
Rank 1
answered on 11 Feb 2011, 03:34 PM
Hi Fern,

You can:

Add the clientEvents .OnDatabound("OnDataBound") to the combobox

function FilterOnDataBound(e) {
  
  
var comboBox = $("#Filters").data("tComboBox");
  
var ExtendedFilter;
  
ExtendedFilter = SetDeleteIconFilter(comboBox.data);
  
//rebind combobox
  
comboBox.dataBind(ExtendedFilter);
  
}

function SetDeleteIconFilter(filterdata) {
    $.each(filterdata, function (intIndex, filterdata) {
        var filterId = filterdata.Value;
        var filterText = filterdata.Text;
        var deleteIcon = '<img class="deletefilter" title="Delete ' + filterText + '" onclick="DeleteFilter(' + filterId + ');" alt="' + filterId + '" src="/content/images/delete_filter_icon.png"/>';
        filterdata.Text = filterdata.Text + deleteIcon;
        filterdata[intIndex] = filterdata;
    });
    return filterdata;
}

In this example an Delete icon is placed behind the text.

Good luck,

Gerard Eikelboom
0
mahmoud
Top achievements
Rank 1
answered on 23 Oct 2011, 01:52 PM
Thanks Gerard but your solution doesn't work in 2011Q2SP1. it simply shows the tags!
any other solution?
Tags
ComboBox
Asked by
Fern
Top achievements
Rank 1
Answers by
Gerard Eikelboom
Top achievements
Rank 1
mahmoud
Top achievements
Rank 1
Share this question
or