从 Sharepoint 列表中填充下拉列表
我正在尝试根据 Sharepoint 列表中的信息动态填充下拉列表。我知道我可以将列表添加到页面并隐藏它,但我想要的是使用客户端脚本语言填充列表,并且当前页面上不存在该列表。我假设采用 ajx 方法,但不确定如何实现这一点。我被限制没有 SP Designer 或 Visual Studio。那么这可以使用 Web 部件或带有客户端脚本代码/ajax 的简单内容编辑器来完成。如果是这样怎么办?
I am trying to dynamically populate a dropdown list based on the information in a Sharepoint list. I know I can add the list to the page and hide it, but what I want is to populate the list using client scripting language and not have the list exist on the current page. I assume an ajx approach, but not sure how to accomplish this. I am restricted to not having SP Designer or Visual Studio. So can this be accomplished using a webpart or a simple content editer with client scripting code/ajax. If so how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于 SharePoint 2007,您可以使用 GetListCollection 方法。
请参阅:
For SharePoint 2007, you can use the GetListCollection method.
See:
查看 功能区自定义 - 下拉控件、客户端对象模型和JavaScript 页面组件。许多代码都是针对功能区的,但 loadCurrentWebLists 和 getDropdownItemsXml 演示了您想要执行的操作。您还可以查看 SharePoint 2010:使用 ECMAScript操作(添加/删除/更新/获取)列表项和OM模型Javascript。这些处理列表项,但您应该能够针对列表调整它们。
Take a look at Ribbon customizations - dropdown controls, Client Object Model and JavaScript Page Components. A lot of the code is for the Ribbon, but the loadCurrentWebLists and getDropdownItemsXml demonstrate what you are trying to do. You can also look at SharePoint 2010: Use ECMAScript to manipulate (Add/Delete/Update/Get) List Items and OM model Javascript. These deal with List Items, but you should be able to adapt them for Lists.
您可以尝试 SPServices 库吗2007 年?
Can you try the SPServices library for 2007?
以下是我如何将其用于用户信息列表,该列表是有权访问该站点的所有用户的列表。
select: function(e, ui){}
是当您从自动完成框中选择某些内容时调用的函数。Here is how i use it for the user information list which is the list of all users with permissions to that site. The
select: function(e, ui){}
is the function which is called when you select something from the autocomplete box.