3

I have a lookup combobox whose source is another SharePoint list. By default, this combobox items are sorted by word order but I want to sort this items with another/custom order. How can I do this?

Such as the default view of this combobox is:

EUR    
USD    
TRY

But I want this combobox with this sort:

TRY    
EUR    
USD

My source list order is the same with following:

Currency CurrencySeq

TRY       1
EUR       2
USD       3
Tschareck
  • 2,155
  • 7
  • 35
  • 52
newbie
  • 1,737
  • 2
  • 19
  • 35

1 Answers1

2

There aren't any server side solutions for doing that unfortunately.

You could check the following solution provided by this post

$(function(){
    var fieldLabel = "LookupField";
    var lookup = $("h3:contains("+ fieldLabel +")").closest("td").next().find("select");
    $(lookup).find("option").sort(function(a,b){
        if(b.innerHTML == 'Test2') return 1;
        return 0;
    }).appendTo($(lookup));
});

Another alternartive, if you are willing to use Infopaths, if I remember well, you can set a sorting on the datasource.

Hope it helps.

GillouX
  • 670
  • 5
  • 13
  • Thank you so much for your help. It helped me and I solved my problem. I did not use JavaScript or JQuery but I found a way at InfoPath as you said. When I wanted to choose a new data source for combobox, I could create a new data connection through InfoPath and choose any column to sort my combobox items. – newbie Apr 30 '12 at 12:48