Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: SP2010 - SPCascadeDropdown with SPFilterDropDowns

$
0
0
Ok, so I know in SPCascadeDropdown you can't have more than one parent column. So I thought instead of using a second parent column, I could force it to pull the Lookup value and force the 3rd field to populate based upon a Filter matching on the ID of the item in the list.... Here's a breakdown of lists:

TRApplication
ApplicationName

TREnvironments
ApplicationName(Lookup on TRApplication)
EnvironmentName
ServerName

The issue is the ServerName. In TREnvironments, I needed it to look at the ApplicationName AND the EnvironmentName to pick the ServerName. If I were to do a SPCascadeDropdown match on the EnvironmentName, it would return multiple values due to the fact that there are repeats in that column. There are UNIQUE matches on the ApplicationName AND EnvironmentName. So my thought was to pull the ID(Value) of the Lookup and use SPFilter to filter the ServerName based upon ID (in the list).

So here is my code:
$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "TREnvironments",
    relationshipListParentColumn: "ApplicationName",
    relationshipListChildColumn: "EnvironmentName",
    parentColumn: "ApplicationSource",
    childColumn: "EnvironmentSource"
  });
  
var EnvSourceValue = $("select[title='EnvironmentSource']").val();

  $().SPServices.SPFilterDropdown({
  relationshipList: "TREnvironments",
  relationshipListColumn: "ServerName",
  columnName: "DataSource",
  CAMLQuery: "<Eq><FieldRef Name='ID' /><Value Type='Text'>" + EnvSourceValue + "</Value></Eq>",
  completefunc: null,
  debug: false
 });
The variable is populating with "0" due to the fact that it defaults to (none).... how can I get it to pull the NEW value once I choose an option for my EnvironmentSource? I've tried adding this, but it didn't work:
$("select[title='EnvironmentSource']").change(function() {
   var EnvSourceValue = $("select[title='EnvironmentSource']").val()
   });

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>