Pre-requisites :
MP India
Karnataka India
CityList
City LookupState
Bangalore Karnataka
Ujjain MP
ParentList - This is the list where I want cascading lookups i.e. on change of Country respective State should come, and further city should load for respective states.
Title LookupCountryParent LookupStateParent LookupCityParent
New India Karnataka Bangalore
- JQuery Reference
- SP Services Reference
Code :
<script type="text/javascript" src="../../SiteAssets/Scripts/jquery.2.1.3.min.js"></script>
<script type="text/javascript" src="../../SiteAssets/Scripts/jquery.SPServices-2014.02.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "",
relationshipList: "StateList",
relationshipListParentColumn: "LookupCountry",
relationshipListChildColumn: "State",
parentColumn: "LookupCountryParent",
childColumn: "LookupStateParent",
debug: false
});
$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "",
relationshipList: "CityList",
relationshipListParentColumn: "LookupState",
relationshipListChildColumn: "City",
parentColumn: "LookupStateParent",
childColumn: "LookupCityParent",
debug: false
});
});
</script>
Explanations:-
- relationshipList - The list which has parent/child relationship.
- relationshipListParentColumn - The lookup column in relationshipList.
- relationshipListChildColumn - The column which is dependent on relationshipListParentColumn.
- parentColumn - The lookup column in parent list/master.
- childColumn - The lookup column in parent list/master list.
Analogy:-
CountryList
Title
India
UK
US
StateList
State LookupCountry
MP India
Karnataka India
CityList
City LookupState
Bangalore Karnataka
Ujjain MP
ParentList - This is the list where I want cascading lookups i.e. on change of Country respective State should come, and further city should load for respective states.
Title LookupCountryParent LookupStateParent LookupCityParent
New India Karnataka Bangalore
No comments:
Post a Comment