This project has moved. For the latest updates, please go here.
1

Closed

SPFilterDropdown Not filtering dropdown column.

description

Hello all,
Thanks in advance for any possible help. I have a Document Library with a Lookup column which points to a custom list. The code I am using is inserted into a CEWP and is shown below. The query is working and in the console I can verify a POST that is returning the correct 11 results from the list. However, the dropdown does not change and still shows all results for the list.
<!-- Reference jQuery on the Google CDN -->
<!-- <script src="/sites/BSOS/apt/SiteAssets/scripts/jquery-1.11.1.min.js"></script> -->
<!-- Reference SPServices on cdnjs (Cloudflare) -->
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.01/jquery.SPServices.min.js"></script>

<script>
$().SPServices.SPFilterDropdown({
      relationshipList: "{2B5088F9-8E5A-42FA-A0AB-AE0B93692037}",
      relationshipListColumn: "Title",
      columnName: "APT Candidate",
      CAMLQuery: "<Eq><FieldRef Name='Academic_x0020_Year' /><Value Type='Choice'>2014-15</Value></Eq>",
      completefunc: null,
      debug: false
});
</script>
I am guessing that this is most likely an issue with the coulmnName parameter. I have tried bot APTCandidate and APT Candidate as those are the internal and display names for the column in the Library.

Is there aything else that I can try or can someone suggest a way to debug. I am not seeing any errors with debug: true, or in Firebug.
Closed Dec 16, 2014 at 5:34 PM by sympmarc
Fixed/deployed in 2014.02

comments

sympmarc wrote Sep 8, 2014 at 7:36 PM

It looks like you are referencing two different copies of jQuery, which could be causing the problem.

The columnName should be the DisplayName of the column on the form, per the docs.

M.

derbium wrote Sep 9, 2014 at 12:52 PM

Marc,
Thanks, the first reference is actually commented out.
I did figure it out though. When I went into firebug and inspected the select element, I discovered that it listed the title attribute as
title="APT Candidate Required Field"...
So I replaced the column name parameter in the code above with that value and it worked.
$().SPServices.SPFilterDropdown({
      relationshipList: "{2B5088F9-8E5A-42FA-A0AB-AE0B93692037}",
      relationshipListColumn: "Title",
      columnName: "APT Candidate Required Field",
      CAMLQuery: "<Eq><FieldRef Name='Academic_x0020_Year' /><Value Type='Choice'>2014-15</Value></Eq>",
      completefunc: null,
      debug: true
});

sympmarc wrote Sep 9, 2014 at 1:47 PM

Aha! That's an issue that was introduced in January when Microsoft made some changes to the DOM. I thought that I had it fixed in 2014.01.

Can you do me a favor and copy out the markup for the "APT Candidate" field for me and paste it here? I'm clearly missing something in my fix.

Thanks,
M.

sympmarc wrote Sep 9, 2014 at 1:50 PM

Also, what version of SharePoint are you on? On premises or Office365?

derbium wrote Sep 9, 2014 at 5:07 PM

Actually, SP2010 on prem:

Source Code:
<select title="APT Candidate Required Field" id="ctl00_m_g_94ceb0f3_c52d_48af_97a1_c125a3d3ab95_ff41_ctl00_Lookup" name="ctl00$m$g_94ceb0f3_c52d_48af_97a1_c125a3d3ab95$ff41$ctl00$Lookup">
<!-- option values removed to protect the innocent -->
</select>

sympmarc wrote Sep 9, 2014 at 9:43 PM

I think I spotted my bug in handling " Required Field". I'm uploading a new alpha for 2014.02. Can you try it out for me and let me know if it works?

You should remove the " Required Field" part of the column name, like so:
$().SPServices.SPFilterDropdown({
      relationshipList: "{2B5088F9-8E5A-42FA-A0AB-AE0B93692037}",
      relationshipListColumn: "Title",
      columnName: "APT Candidate",
      CAMLQuery: "<Eq><FieldRef Name='Academic_x0020_Year' /><Value Type='Choice'>2014-15</Value></Eq>",
      debug: true
});

derbium wrote Sep 9, 2014 at 11:38 PM

Marc,
It works. Was able to download and reference the Alpha 3 version, verified it was loading the correct version in firebug and it worked with the " Required Column" in the columnName. I then removed " Required Column" from the columnName and it was still filtering as expected.

Thanks for your help,
Dave

P.S. should I continue using the alpha version in production, or revert and wait for the next release?

sympmarc wrote Sep 10, 2014 at 3:45 AM

Great to hear. What you do from here is entirely up to you. You can see from the download page what changes I've made in the alphas so far. It hasn't been significant stuff, really.

M.

RamblinHans wrote Sep 16, 2014 at 5:21 PM

2014.02 fixed this exact issue for me as well. Awesome work, thanks!

sympmarc wrote Sep 17, 2014 at 5:57 PM

Excellent! Keep in mind that this is still an alpha and will change before release.

sulabhgupta wrote Dec 4, 2014 at 9:42 AM

Mark,

I am still facing the same issue even with the latest release (jquery.SPServices-2014.01BETA2.js). If i remove the required field from settings, the filter starts working.

sulabhgupta wrote Dec 4, 2014 at 9:43 AM

Forgot to mention, I am on SP 2010 On Prem (SP2)

sympmarc wrote Dec 4, 2014 at 2:41 PM

sulabhgupta:

Can you post your details in a new thread in the Discussions? The original posters' issue was resolved here, so I'd like to gather the details for your issue to see if it's the same thing.

Thanks,
M.