问题描述
我需要修改$().SPServices.SPCascadeDropdowns,以便RelationshipList参数是动态的.我想更新relationshipList参数使用的GUID 根据所选的产品类型.
I need to modify $().SPServices.SPCascadeDropdowns so that the relationshipList parameter is dynamic. I want to update the GUID that the relationshipList parameter uses based on a Product Type selected.
更改产品类型"下拉列时将调用以下代码.但是,似乎没有 $().SPServices.SPCascadeDropdowns被调用.未对childColumn进行更新,以根据更新的RelationshipList显示新值.
The code below is called when the Product Type dropdown column is changed. However, it doesn't appear that$().SPServices.SPCascadeDropdowns is being called. The childColumn is not updated to display new values based on the updated relationshipList.
任何帮助将不胜感激. TIA
Any assistance would be appreciated. TIA
$("select [title ='Product Type']")).change(function(){
var valGLBProductType = $(" select [title ='Product Type']).find('option:selected').text();
if(valGLBProductType =='xyz){
valViewID ="{GUID}";
}其他{
valViewID ="{GUID}";
}
$().SPServices.SPCascadeDropdowns({
relationshipList:valViewID,
relationshipListParentColumn:投标",
relationshipListChildColumn:"ActiveTitle",
&parentb:提案",
childColumn:要替换的文档",
调试:true
});
});
$("select[title='Product Type']").change(function() {
var valGLBProductType = $("select[title='Product Type']").find('option:selected').text();
if(valGLBProductType=='xyz){
valViewID ="{GUID}";
}else{
valViewID = "{GUID}";
}
$().SPServices.SPCascadeDropdowns({
relationshipList: valViewID,
relationshipListParentColumn: "Proposal",
relationshipListChildColumn: "ActiveTitle",
parentColumn: "Proposal",
childColumn: "Document To Replace",
debug: true
});
});
推荐答案
relationshiplist值来自条件为select的更改事件,如果条件中缺少':
relationshiplist value comes from a select change event if condition, in the condition, there is a missing ':
if(valGLBProductType=='xyz')
请确保传递给RelationshipList的valViewID有效,您可以console.log这个变量来检查值.
And please make sure the valViewID passed to relationshipList is valid, You can console.log this variable to check the value.
这里是有关两个SPServices.SPCascadeDropDowns的详细代码演示,供您参考:
Here is a detailed code demo about two level SPServices.SPCascadeDropDowns for your reference:
<script src="https://code.jquery.com/jquery-1.12.4.js" type="text/javascript"></script>
<script type="text/javascript" src="http://sp/sites/dev/SiteAssets/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript">
结果:
Result:
更多信息:
https://www. codeproject.com/Tips/758909/使用Level-Cascading-Drop-Down-in-SharePoint进行两级级联
谢谢
最好的问候
这篇关于SPCascadeDropdowns动态关系列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!