{"id":946,"date":"2010-12-17T13:58:06","date_gmt":"2010-12-17T12:58:06","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=946"},"modified":"2015-09-08T20:34:08","modified_gmt":"2015-09-08T18:34:08","slug":"extended-cascading-with-spservices-and-jquery","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/extended-cascading-with-spservices-and-jquery\/","title":{"rendered":"Extended cascading with SPServices and jQuery"},"content":{"rendered":"<p>Recently I wrote a plugin which provided cascading dropdowns with jQuery and SPServices, which you can find <a href=\"https:\/\/www.itidea.nl\/index.php\/cascading-dropdowns-with-jquery-and-spservices-on-a-page-or-webpart\/\">here<\/a>.<\/p>\n<p>To be more flexible about how to display this to the user I extended the plugin. With the extended plugin it is possible to show the parent values of the cascading part with radiobuttons and the child part still with a dropdown list. Also a new option is added to load the values of the childdropdown by default or to wait for the user to make a selection in the parent list.<\/p>\n<p>To show the values of the parent list in a radiobutton list\u00a0use the id of a <span style=\"text-decoration: underline;\">div<\/span> element present in the page:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;div id=&quot;countriesRadio&quot;&gt;&lt;\/div&gt;\r\n<\/pre>\n<p>and call the plugin on this div:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script type=&quot;text\/javascript&quot; src=&quot;..\/jQueryLibrary\/jquery-1.4.4.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot; src=&quot;..\/jQueryLibrary\/jquery.itidea_spcascadingdropdownExtended.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot; src=&quot;..\/jQueryLibrary\/jquery.SPServices-0.5.6.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\r\n$(document).ready(function () {\r\n\r\n\u00a0\u00a0\u00a0 $('#countriesRadio').itidea_spcascadingdropdownExtended(\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 relationshipList: &quot;Cities&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 relationshipParentList: &quot;Countries&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 relationshipParentListColumn: &quot;Title&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 relationshipListChildColumn: &quot;Title&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 relationshipListParentColumn: &quot;Country&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 childdropdown: &quot;citiesRadio&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fillChildByDefault: true\r\n\u00a0\u00a0\u00a0 });\r\n\r\n});\u00a0\r\n\r\n&lt;\/script&gt;\r\n\r\n<\/pre>\n<p>In the above code sample the new option fillChildByDefault is set to false. This means the values of the parent will be showed, but no child values will be showed\u00a0 when the page loads. If this option is omitted in the above code the value is set to true by default in the plugin and the child values will be shown when the page loads.<\/p>\n<p>With the above settings the controls look like this:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedNoDefaultFill.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-949\" title=\"CascadingExtendedNoDefaultFill\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedNoDefaultFill.png\" alt=\"\" width=\"325\" height=\"108\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedNoDefaultFill.png 325w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedNoDefaultFill-300x99.png 300w\" sizes=\"auto, (max-width: 325px) 100vw, 325px\" \/><\/a><\/p>\n<p>By omitting the option fillChildByDefault (which is the same as setting this to true):<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedDefaultFill.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-947\" title=\"CascadingExtendedDefaultFill\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedDefaultFill.png\" alt=\"\" width=\"320\" height=\"160\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedDefaultFill.png 320w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedDefaultFill-300x150.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>When an item is selected:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedItemSelected.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-948\" title=\"CascadingExtendedItemSelected\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedItemSelected.png\" alt=\"\" width=\"318\" height=\"129\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedItemSelected.png 318w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/CascadingExtendedItemSelected-300x121.png 300w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>With the extended plugin more flexibility is added to show the values to the user. With this plugin it is still possible to show both lists as dropdownlists by replacing the <span style=\"text-decoration: underline;\">div<\/span> element by a <span style=\"text-decoration: underline;\">select<\/span> element with the same id as shown in the <a href=\"https:\/\/www.itidea.nl\/index.php\/cascading-dropdowns-with-jquery-and-spservices-on-a-page-or-webpart\/\">previous post <\/a>about cascading dropdowns.<\/p>\n<h3>Download<\/h3>\n<p>Download the plug-in:\u00a0[download#4]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I wrote a plugin which provided cascading dropdowns with jQuery and SPServices, which you can find here. To be more flexible about how to display this to the user I extended the plugin. With the extended plugin it is &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/extended-cascading-with-spservices-and-jquery\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,8],"tags":[11,33],"class_list":["post-946","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2007","category-sharepoint-2010","tag-jquery","tag-spservices"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=946"}],"version-history":[{"count":11,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/946\/revisions"}],"predecessor-version":[{"id":2038,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/946\/revisions\/2038"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}