级联下拉菜单-需要第二双眼睛 [英] Cascading dropdown - need a second pair of eyes

查看:84
本文介绍了级联下拉菜单-需要第二双眼睛的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在使用以下在Internet上找到的JavaScript代码,用于在sharepoint中进行级联下拉.首先,我将分享我要完成的任务的快速快照,然后分享脚本.

So I am using the following javascript code that I found on the internet for cascading dropdowns in sharepoint.  First I will share a quick snapshot of what I am trying to accomplish and then I will share the script.

这些是SharePoint列表.第一行(我想是父母吗?)有一个列-标题.这是会议的名称(或任务的来源,顺便说一句,这些列表的目标是跟踪会议记录和分配操作(WWW) 对人们. WWW代表何时何地".会议列表中的来源"列是对来源"中标题"的查找.列表中还有许多其他字段,但与级联过滤器无关.然后在WWW列表中, 还有一个Source列,它是Sources中的Title的查找,然后是SourceDateTime列,是Meetings列表中MtgDate的查找.  

These are SharePoint lists.  The first (I think is the parent?) has one column - Title.  This is the name of the meeting (or the Source for the task, which btw, the goal of these lists is the keep track of meeting notes and assign actions (WWW) to people.  The WWW stands for What-Who-When).  The Source column in the Meetings list is a lookup to Title in Sources.  There are a number of other fields in the list, but are not pertinent to the cascade filter.  Then in the WWW list, there is also a Source column that is a lookup to Title in Sources and then SourceDateTime column that is a lookup to MtgDate in the Meetings list.  

因此,如果用户创建了一个新的WWW,我希望他们选择会议(源)标题,然后第二个下拉菜单将询问所选择的会议筛选的会议日期.这背后的原因是我们有一些会议 是每个季度一次,每个月一次,我们不希望该标题成为自由格式的字段.

So if the user creates a New WWW, my wish is that they select the meeting (source) title and then the second drop down would ask for the meeting dates that are FILTERED by the meeting selected.  The reasoning behind this is we have some meetings that are quarterly, monthly, and we do not want that title to be a free form field.

这是我正在使用的javascript.我已经在新建项目"页面上的内容Web部件中使用了它(然后,一旦我开始使用它,它也将进入编辑项目"页面).

Here is the javascript I am using.  I have used it inside a content web part on the New Item page (and then subsequently once I get this working, it will also go on the Edit Item page).

<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="../../SiteAssets/MTCascade.js"></script>

<script type="text/javascript">
	$(document).ready(function() {
	
		var cascadeArray = new Array();
		//alert("Break");
		//For the meeting tool 
		//
		cascadeArray.push({
			parentFormField: "Source", //Display name on form of field from parent list  /What is the parent field?
			childList: "MeetingTool", //List name of child list  /Where does the list of the meeting dates come from?
			childLookupField: "Source", //Internal field name in Child List used in lookup /What field in the meeting list has the name of the date?
			childFormField: "SourceDateTime", //Display name on form of the child field /What is the name of the field on the form for the date?
			parentFieldInChildList: "Source", //Internal field name in Child List of the parent field /What is the name of the field in the WWW list that has the name of the meeting
			firstOptionText: "< Select a Date >"
		});
		$().MTCascade(cascadeArray);
	});
</script>

我放入警报"只是为了确保正在读取脚本,但是确实没有过滤SourceDateTime列,并且仍然具有Meetings表中的所有日期.  

I put in the Alert just to make sure that the script is being read, and it is, however the SourceDateTime column is not being filtered and still has ALL the dates from the Meetings table.  

感谢您成为第二只眼睛"看看我在哪里放错了东西.

Thanks for being that "second set of eyes" and seeing where I have misplaced something.

布拉德

布拉德·艾莉森

推荐答案

您可以在以下最常用的开源库中查看

You could check below most used open source library


().SharePoint中的SPServices.SPCascadeDropdowns,下面的线程提供了一个示例,该示例显示了构建层叠下拉列表的详细步骤.
().SPServices.SPCascadeDropdowns in SharePoint, below thread provides a sample which shows detailed steps for building cascade dropdown.

从下面的链接中获取库(使用jquery-1.11.3.js可以防止任何 兼容性问题 ).

Get the library from below link(use jquery-1.11.3.js to prevent any compatibility issue).

http://sympmarc.github.io/SPServices/

最好的问候,

Lee


这篇关于级联下拉菜单-需要第二双眼睛的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆