Forth Level Selection issues - SPCascadeDropdowns

Dec 10, 2012 at 11:44 AM

Please please help me!! I absolutely love the SPService set of jQuery tools but I'm really struggling the Cascading drop downs. I've managed to get it working normally and it does so under normal circumstances where it's a linear flow, however, I have a slightly more complex scenario.... I have 4 lists, City -> Property -> Room Type -> Room

Everything works perfectly up to the room point. Because multiple properties have the different room types then the list of rooms is just bringing me back rooms for the different properties and not the one selected.

I've tried to use CAML query but I just can't seem to get this to work 

If there's anyone that has done something similar or can help me it would be greatly appreciated. 

The code I have so far is:

$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Property",
relationshipListParentColumn: "Title",
relationshipListChildColumn: "Property",
parentColumn: "City",
childColumn: "Property",
});
$().SPServices.SPCascadeDropdowns({
relationshipList: "RoomType",
relationshipListParentColumn: "Property",
relationshipListChildColumn: "RoomType",
relationshipListSortColumn: "ID",
parentColumn: "Property",
childColumn: "RoomType"
});
$().SPServices.SPCascadeDropdowns({
relationshipList: "Room",
relationshipListParentColumn: "RoomType",
relationshipListChildColumn: "BedSpace",
relationshipListSortColumn: "ID",
parentColumn: "RoomType",
childColumn: "Room"
});
});
</script>

Coordinator
Dec 10, 2012 at 1:25 PM

Phil:

By default - as I originally implemented the SPCascadeDropdowns function - the matching is done using the text values. In v0.7.1, I added an option called matchOnId, which does pretty much what you'd expect. Rather than matching based on the text value, it matches on the ID of the parent item. I think using that option ought to fix your issue.

Keep in mind, however that to an end user, two values with the same text are the same value; they can't see any difference. It may present other issues down the road which you should consider.

M.

Dec 10, 2012 at 1:38 PM

Thanks for the reply, I'm not sure if that will help, I uploaded the data in 4 separate lists as I took the data from an SQL export and I'm just looking up against that.

 

If I was to try as you suggested, how would I go about that?

 

Thanks,

 

Phil

Coordinator
Dec 10, 2012 at 1:39 PM

Phil:

I think it will. It switches the mathing from the text values to the ID of each value in the SharePoint lists.

M.

Dec 10, 2012 at 5:13 PM

No, unfortunately not. The problem is that I've done it quite a 'dirty' way.

I took an export from the SQL data base and then created the separate lists and just copied and pasted the data into the lists. (Hands up, I'm not a programmer and I know there's better ways to do this!)

So I have City, that has an ID and the City name.

Property that has the City name and the Property

RoomType that has City, Property and RoomType

Finally Room that has: City, Property, RoomType and BedSpace (along with a host of other information)

Does this make sense? Hence why I was trying to use the CAML query so that it used the cascading list to get the room type but then the CAML query to filter the property too leaving me with just the rooms in that Property for the selected room type.

 

Thanks,

 

Phil

Coordinator
Dec 10, 2012 at 7:27 PM

Phil:

Ok, you have different problems, then.

One issue is that you're not pointing to the right column is the code. In each list, the unique key is the Title column. That's the childColumn in each case.

Also, you only want to maintain one relationship per list. Take a look at the Country/Region/State example in the docs.

M.


Jan 18, 2013 at 3:45 PM

Marc,

 I've used SPServices successfully for a couple of projects. One recent struggle I'm hoping you can help with is similar (if not the same) as Phil's.

Example: Cascading Lookups for columns A through D. Column D's lookup needs to not only be based on the selection in column C, but that of A, B and C. 

Is this the same issue where I should be using the ID as the key?

 

I appreciate any assistance. Thanks, Jack

Coordinator
Jan 18, 2013 at 3:48 PM

Jack:

SpCascadeDropdowns can only do a one-to-one relationship. If you can come up with a way for that to work by structuring your data differently, then great. Otherwise, you'll need to customize something for yourself.

M.