SPCascadeDropdowns LookupMulti taking ~5 seconds per call

Jan 11, 2011 at 2:56 AM

I have a fairly lengthy edit form, in which I have 2 parent-child fields where I'm using SPCascadeLookups. These are both multiple select lookup fields. The more significant of these two groups involves a parent list with 17 items, and a child list with 4 items per parent list item (17x4 = 68 total items). So in other words, the maximum # of items returned for the child list is 4. When I comment out the SPCascadeDropdowns calls, the page loads and all my other jQuery runs immediately. With both SPCascadeLookups calls, the page takes 9-10 seconds to finish processing *after* the form renders initially. This is in IE7. In Firefox, it's much more responsive -- still a small delay, but much more tolerable.

Here are the two calls I'm making at the end of my $(document).ready function:

$().SPServices.SPCascadeDropdowns({    relationshipList: "Objectives",    relationshipListParentColumn: "Plan",    relationshipListChildColumn: "Title",    parentColumn: "Plan",    childColumn: "Objectives"});

$().SPServices.SPCascadeDropdowns({    relationshipList: "Vendor Contacts",    relationshipListParentColumn: "Vendor_x0020_Name",    relationshipListChildColumn: "Title",    parentColumn: "Vendor",    childColumn: "Vendor Contact",    CAMLQuery: "<Eq><FieldRef Name='ItemActive'/><Value Type='Boolean'>1</Value></Eq>"});


Let me know if you need any more info... thanks!


Jan 12, 2011 at 11:47 AM


Obviously there's an expense to do the Web Services calls to make this work, so some delay is to be expected. However, it sounds longer that I'd expect.

What version of SPServices are you using? Have to tried testing with IE8 just for comparison?


Jan 13, 2011 at 8:35 PM

I'm using SPServices 0.5.8. I'll try to find someone that has IE8 to test it out. There also seems to be quite a bit of lag when clicking on the dropdown arrow for the parent list. Does SPCascadeDropdowns add any other client code that might be firing on click or another event before the parent value changes?

Also, I was thinking it might be nice to add the ability to grab the full child list during the first web service call and maybe store the data as xml in a global variable or data island on the page so that subsequent dropdown changes wouldn't have to make additional web service calls.

On a related note, I tried playing around with the jQuery BlockUI plugin to at least try to show a "Please wait..." dialog and prevent user input while the SPCascadeDropdowns calls were happening. I tried calling $.blockUI(); at the beginning of my $(document).ready function, and then unblock at the end (after some code to add validation, hide some fields, and finally make the 2 SPCascadeDropdowns calls), but it didn't seem to work in IE7. In FireFox, I saw the "Please Wait" message flash briefly at the very end of the script load sequence instead of showing up once the DOM was ready and then disappearing when the scripts were finished executing.

Anyway, if you or anyone else knows of a way to at least give the user some feedback letting them know that something is happening instead of just freezing the page completely, that would be awesome.




Jan 13, 2011 at 9:01 PM
Edited Jan 14, 2011 at 1:09 AM
-- garbage removed --
Jan 14, 2011 at 12:27 AM

uh... what??? lol

Jan 14, 2011 at 1:08 AM
Sorry about that. Sometimes it happens when I reply from my iPhone. Here's what I really said: Rob: Do the dropdowns here have 20+ options? In that case, SharePoint uses a complex dropdown that requires a dblclick to select. Try turning off the script and see what I mean. The 8 seconds or whatever it takes is a timing that SharePoint introduces, not SPCascadeDropdowns. M.
Jan 14, 2011 at 1:17 AM

yes, I have read about that issue (from one of your blog entries, I believe) and have had to adjust some jQuery to handle that in other areas... but it's not to blame for the 8 seconds. i tried commenting out the 2 SPCascadeDropdowns calls and the page loaded immediately. my SP application seems to have been pretty solid so far otherwise with the customer, so my primary focus in the next couple weeks should be making my edit form more bearable... let me know if you come across idle cycles and wanna collaborate on a better solution, heh. btw - thanks for the speedy responses.

Jan 14, 2011 at 1:28 AM
If the only delay that's a problem is on page load, there will of course be some delay, as I said, to do the initial Web Services calls. Those AJAX calls go back to the server to grab the list items, so if SharePint is slow for you in the browser, the Web Services calls will be slow, too. When you say that both are multiple select lookups, do you mean that they are rendered with boxes on the left and right with two buttons in the middle to move items from right to left and left to right? Do you see a comparable delay each time you make a selection as you see on page load? M.
Jan 14, 2011 at 2:39 AM

let me describe the lists with a little more detail.... 

list 1 - Vendor --> Vendor Contact

Vendor is a single-select dropdown with > 20 items, so it uses the crappy input html element instead of the select element. The child list is Vendor Contacts, which is also a single-select dropdown control.


list 2 - Learning Plan --> Research Objectives

Learning Plan is a single-select dropdown, currently with < 20 items. The child list is Research Objectives, which shows up as a multi-select list like you described (2 select lists with add/remove buttons in between). At this point, I'm not convinced that the list types have anything to do with the delay. I feel like each web service call is probably costing about 4 seconds during the page load.


What I've noticed tonight is that changing the Vendor dropdown takes almost 3 minutes to populate the Vendor Contact dropdown. I'm guessing something's up with our server at night.... maybe they're running backups... I'll check this again in the morning.

Anyway, I'm wondering if there could possibly be a better solution when only a couple lists will be used for this and they are known ahead of time... i.e. maybe these can be cached on a more global level so that the expensive web service calls don't have to be made every time. Just thinking out loud here.

Jan 15, 2011 at 4:06 PM

Three minutes! You must have something serious going on with your server.

SPCascadeDropdowns is written to handle all variations on the theme, so it has to have a lot of logic branches. I suppose if you aren't happy with how it works you could clone it and build your own.

What you describe is not that different than my standard Country/Region/State/City exanmple. There I have three calls to SPCascadeDropdowns, some are simple selects (Country and Region), some are complex selects (States), and Cities is a multiple select. While there can be a second or two of delay, even when you choose the Country and it has to cascade three times, I rarely see delays like you are experiencing, even when I test in a VM on my laptop.

Again, I'd look at how your server is performing. Also, try looking at the traffic with Firebug and/or Fiddler to see which calls are the most expensive. That might give us a better handle on exactly what is slowing things down. I still think it's a general server performance issue, though.


Jan 16, 2011 at 10:47 PM

I think the 3 minute thing was due to testing during late night scheduled backup time. As for the load delay, I'm starting to think IE7 might be to blame. I tested everything on my development VM which doesn't typically have quick response times. It does, however, have IE8, and the SPCascadeDropdowns takes less than a second to render. It is making a local web services call, but the VM is slow as molasses.

I'll try to find someone with IE8 to test in the production environment tomorrow. Thanks for your patience and assistance. I'll let you know what I find out.

Jan 17, 2011 at 12:28 AM
I'll be interested to hear what you find out. It seems like most shops skipped from IE6 to IE8 (where things were locked down). I haven't tested with IE7 because of that, not have I heard about issues from anyone else that I can recall. M.
Jan 17, 2011 at 2:18 PM

I uninstalled IE7 and am back on IE6 now. Whether it's an IE7 thing or just our servers running better today, I'm not seeing the performance degradation when loading the form today. Whatever the cause, hopefully it won't reappear... in the mean time, I'm going to play around with some spinners to at least let the user know something is happening if the delay does come back. Thanks again!