views:

225

answers:

3

I have a SharePoint feature which programatically creates 3 lookups in a custom list, one from each of 3 different lists via extremely similar CAML markup.

The only differences in the CAML are the List, ID, Name, DisplayName and StaticName properties yet one of these lookups looks slightly different (has a slightly more "modern" drop-down arrow) than the other two and this same menu requires I double-click in order to select an item instead of single-clicking as I do with the other lookups.

Might anyone have seen this before and have an idea of what I might look into to make this lookup operate as a single-click menu?

A: 

I have exactly the same problem. One difference I have noticed is that the one listbox that requires a double-click is a lookup field, whereas the one that doesn't is a choice field with pre-populated choices. Don't know if that helps.

Brian Payton
All of the fields in question in my list are lookup fields.Each looks up from a different list instance but each list is of the same list type. Each lookup is displaying the column in the source list.
antik
+1  A: 

How many items has the source list of every lookup field?

Lookup fields shows a "Combo" when the source list has 10 items (I'm not sure if 10 item is the exact limit). When the source list has more than 10 items the lookup field shows a "ListArea" control that works as you said.

jaloplo
I wondered if number of items had something to do with this: the list in question does have more entries than the others (it probably has 20 or so).Now, my problem is, I want the behavior to go away. Can it be changed?
antik
As far as I know you can't.
jaloplo
+2  A: 

The style of dropdown displayed is usually related to the number of items, although it also renders as a standard select element when viewed in firefox.

For any other field type it would make sense to create a custom field control, but due to code that expects things to be named "Lookup", lookup fields are next to impossible to extend.

The best way to customize a specific field is probably with javascript/jquery. When you click on the dropdown arrow, ShowDropdown (in core.js) is called. This creates a select element with options set from the pipe delimited list in the choices attribute of the textbox.

Add some code to the page so that on load EnsureSelect and FilterChoice or similar are called to create the select element. Set properties on the textbox and select elements so that the textbox as hidden and the select element is a visible dropdown. Have SetCtrlFromOpt called on change rather than on blur/double click so that the control that the server will read and save is properly updated.

The same approach could be used to keep the combo box but add a click event to set the value rather than requiring a double click.

Tom Clarkson
This sounds like a lot of leg work to solve this problem but so far, it's the best answer I've got. Thanks!
antik

related questions