为什么 SharePoint 查找菜单需要双击才能选择项目?

发布于 2024-08-19 11:33:58 字数 270 浏览 7 评论 0原文

我有一个 SharePoint 功能,它以编程方式在自定义列表中创建 3 个查找,通过极其相似的 CAML 标记从 3 个不同列表中的每一个中创建一个。

CAML 中唯一的区别是 List、ID、Name、DisplayName 和 StaticName 属性,但其中一个查找看起来与其他两个略有不同(具有稍微更“现代”的下拉箭头),并且此相同的菜单需要我双击单击以选择一个项目,而不是像我在其他查找中那样单击。

可能有人以前见过这个,并且知道我可能会研究什么以使此查找作为单击菜单进行操作?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

囍笑 2024-08-26 11:33:58

显示的下拉列表的样式通常与项目数量相关,尽管在 Firefox 中查看时它也会呈现为标准选择元素。

对于任何其他字段类型,创建自定义字段控件都是有意义的,但由于代码期望将事物命名为“Lookup”,因此查找字段几乎无法扩展。

自定义特定字段的最佳方法可能是使用 javascript/jquery。当您单击下拉箭头时,将调用 ShowDropdown(在 core.js 中)。这将创建一个选择元素,其中包含从文本框的 choice 属性中的管道分隔列表中设置的选项。

向页面添加一些代码,以便在加载时调用 EnsureSelect 和 FilterChoice 或类似的代码来创建选择元素。设置文本框和选择元素的属性,以便文本框隐藏并且选择元素是可见的下拉列表。在更改时调用 SetCtrlFromOpt,而不是在模糊/双击时调用,以便服务器将读取和保存的控件正确更新。

可以使用相同的方法保留组合框,但添加单击事件来设置值,而不需要双击。

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.

阳光①夏 2024-08-26 11:33:58

每个查找字段的源列表有多少项?

当源列表有 10 个项目时,查找字段显示“组合”(我不确定 10 个项目是否是确切的限制)。当源列表有超过 10 个项目时,查找字段会显示一个“ListArea”控件,其工作方式如您所说。

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.

泛滥成性 2024-08-26 11:33:58

我有完全相同的问题。我注意到的一个区别是,需要双击的列表框是查找字段,而不需要双击的列表框是带有预填充选项的选择字段。不知道这是否有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文