SPCascadeDropDown doesn't show child on parent selection

Nov 26, 2012 at 3:58 PM
Edited Nov 26, 2012 at 3:59 PM
Hello, I have a problem with the following code.
The parent list is filled, but when I select an item, 
it displays nothing in the child list.
I Use Sharepoint 2010, with the last stable versions of JQuery and SPServices.
N.B. : The child list is a multi-selection list.
<script language="javascript" type="text/javascript">
	
	function MyLoadFunction() {
		// Masquer le champ identification technique
		$('nobr:contains("Identification Technique")').closest('tr').hide();

		// Relation entre les listes déroulantes "Module ESB" et "Service Web"
		$().SPServices.SPCascadeDropdowns({			
			listName: "DemandeAccesWebService2",
			// nom de la liste "enfants" -celle de la seconde selection
			relationshipList: "ServiceWeb",
			// nom INTERNE de la colonne correspondant à la liste "parent" dans la liste "enfants"
			relationshipListParentColumn: "Module_x0020_Logiciel",
			// nom interne de la colonne à recuperer dans la liste "enfants"
			relationshipListChildColumn: "Title",
			// nom d'affichage (display) de la colonne du formulaire (parent)
			parentColumn: "Module ESB",
			// nom d'affichage (display) de la colonne du formulaire (enfant)
			childColumn: "Nom du Service Web",
			debug: true
		});
	}

	_spBodyOnLoadFunctionNames.push("MyLoadFunction");
</script>
Coordinator
Nov 26, 2012 at 4:27 PM

I don't see anything obviously wrong. Are you getting any error popup (from SPServices' debug mode) or in the console in the browser?

You do have a parameter which won't do anything: listName: "DemandeAccesWebService2". The relationshipList is the list that the function will use.

M.

Nov 27, 2012 at 11:02 AM

Hello, thanks for your answer,

I have no error message (debug mode, and console).

I removed the listName parameter, the result is the same.

I forgot to tell that I use Internet Explorer 8.

What's the better way to find why ? What tools do you use to trace what's happening ? I know fiddler, for example.

Coordinator
Nov 27, 2012 at 12:25 PM

If you know Fiddler, take a look at the results returned fro the calls to Lists.asmx. You should be able to see the data coming back and whether it contains what you'd expect.

The other thing to check is whether your list structures match what's required. Perhaps your data isn't organized correctly?

M.

Nov 27, 2012 at 2:24 PM

With fiddler, I found that the relationship list name I used was not correct.

I thought I had to use the static name of the list (that we can find in the URL), but finally it seems that it's the display name that we must use.

When I put "Services Web" instead of "ServicesWeb" it works ok. So this problem is solved.

However, I have another question about SPCascadeDropdowns :-)

In the case of a multivalued child list, I wonder if there is a way to keep the values that have already be selected, so that we are able to select children which come from different parents ?

Coordinator
Nov 27, 2012 at 3:38 PM

No, you can't select children from different parents. It's strictly hierarchical, sorry.

M.

Nov 27, 2012 at 3:40 PM

@sbaudry,

That'd be cool to do!

Nov 27, 2012 at 4:02 PM

Would it be complicated to have a new boolean parameter, let's say "NonHierarchical",

and if it is true, the already selected children are not reinitialised when we select a different parent ?

I'm quite new with JQuery so I can't really modify SPCascadeDropdowns function myself...

Coordinator
Nov 27, 2012 at 4:20 PM
Edited Nov 27, 2012 at 4:20 PM

It would indeed be complicated. If you think about it, there are some edge conditions which might get messy. I can add it to the list for enhancements, but it won't happen too soon.

M.

Coordinator
Nov 27, 2012 at 4:49 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.