This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CascadingMMD = window.CascadingMMD || {}; | |
CascadingMMD.termPathList = new Array(); //An array to store the paths of all terms in the termset (Continents, Countries and Regions) | |
CascadingMMD.CountryVals = new Array(); //An array to store only countries | |
CascadingMMD.RegionVals = new Array(); //An array to store only regions | |
CascadingMMD.CountryValsWithRegion = new Array(); //An array to store countries and regions | |
CascadingMMD.ddlCountry; //Country drop down | |
CascadingMMD.ddlRegion; // Region drop down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
//call the function to hide controls (see below in the blog) | |
CascadingMMD.Libs.hideControlsOnLoad(); | |
//get the list stored in the cookie | |
var listFromCookie = CascadingMMD.Libs.getCookie("TermsPathList"); | |
if(listFromCookie != null) { | |
//split the value in the cookie by ',' and store it in termPathList | |
CascadingMMD.termPathList = decodeURIComponent(listFromCookie).split(","); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hideControlsOnLoad = function(){ | |
CascadingMMD.ddlCountry = $('#ddlCountry'); | |
CascadingMMD.ddlCountry.hide(); | |
CascadingMMD.ddlRegion = $('#ddlRegion'); | |
CascadingMMD.ddlRegion.hide(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getTermSetData = function(){ | |
//Current Context | |
var context = SP.ClientContext.get_current(); | |
//Current Taxonomy Session | |
var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context); | |
//Term Stores | |
var termStores = taxSession.get_termStores(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getDataContinent = function(){ | |
var ddlContinent = $('#ddlContinent'); | |
$.each( CascadingMMD.termPathList, function( index, value ){ | |
if(value.indexOf(';') < 0){ | |
ddlContinent.append( | |
$('<option></option>').html(value) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addContinentChangeHandler = function(){ | |
$("#ddlContinent").change(function() { | |
var str = ""; | |
$( "#ddlContinent option:selected" ).each(function() { | |
str += $( this ).text(); | |
}); | |
//If selected text is first one "Select", then empty other drop downs and hide them | |
//Can use selected value instead of selected text | |
if(str == "Select"){ | |
CascadingMMD.ddlCountry.empty(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This function is similar to the previous one | |
var addCountryChangeHandler = function() { | |
$('#ddlCountry').change(function(){ | |
var str = ""; | |
$( "#ddlCountry option:selected" ).each(function() { | |
str += $( this ).text(); | |
}); | |
if(str == "All"){ | |
CascadingMMD.ddlRegion.empty(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var CascadingMMD = window.CascadingMMD || {}; | |
CascadingMMD.termPathList = new Array(); //An array to store the paths of all terms in the termset (Continents, Countries and Regions) | |
CascadingMMD.CountryVals = new Array(); //An array to store only countries | |
CascadingMMD.RegionVals = new Array(); //An array to store only regions | |
CascadingMMD.CountryValsWithRegion = new Array(); //An array to store countries and regions | |
CascadingMMD.ddlCountry; //Country drop down | |
CascadingMMD.ddlRegion; // Region drop down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> | |
<script src="../Shared Documents/CascadingMMD.js"></script> | |
<link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/2.2.0/fabric.min.css"> | |
<link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/2.2.0/fabric.components.min.css"> | |
</head> | |
<body> |
OlderNewer