Tuesday, July 17, 2012

Developing Cascading dropdowns:

$().SPServices.SPCascadeDropdowns:
The SPCascadeDropdowns function lets you set up cascading dropdowns on SharePoint forms. What this means is that you can enforce hierarchical relationships between column values. The function uses the GetListItems operation of the Lists Web Service to refresh the allowable values based on relationships which are maintained in reference lists. By implementing this function, there are no coding requirements to manage the hierarchical relationships (once it is in place) and you can let your users manage the content in the reference lists.
Like:
Code:
$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipList: "RegionList",
relationshipListParentColumn: "Country",
relationshipListChildColumn: "Title",
parentColumn: "Country",
childColumn: "Region",
debug: true
});
$().SPServices.SPCascadeDropdowns({
relationshipList: "StateList",
relationshipListParentColumn: "Region_x0020_Name",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "ID",
parentColumn: "Region",
childColumn: "State"
});
});
</script>
References: http://spservices.codeplex.com/documentation

No comments:

Post a Comment