Tuesday, March 30, 2010

Sharepoint 2 - Cascaded Lookup Dropdowns

there is a javascript components we can use directly, follow the instruction of this link,http://www.sharepointboris.net/js/spcd/

1. Download the spcd.js from codeplex: http://spcd.codeplex.com/

2. Upload our spcd.js to our documents library

3. Build the list show the relationship with the dropdown item and child nodes, such as: product-newspapers list, product-version list.

4. In the item page, add 2 paramters to the URL: PageView=Shared&ToolPaneView=2 and add the Content Editor Webparts

5. Specify the javascript code in the source code editor, like:
< script type="text/javascript" src="[paste-javascript-url-here]">
var ccd1 = new cascadeDropdowns(ParentDropDownTitle, ChildDropDownTitle, Child2ParentFieldIntName, ChildListNameOrGuid, ChildLookupTargetField);
< /script>

For example:
< script type="text/javascript">
var ccd1 = new cascadeDropdowns("Account", "Branch", "Account", "Branches", "Title");
< /script>

No comments: