SPFilterDropDown: Filter doesn't work if I click remove from multi select column

Jun 6, 2011 at 2:57 PM
Edited Jun 7, 2011 at 9:02 AM

Hi,

I'm trying to use SPFilterDropDown function to filter a multi select column based on querystring parameter.

I'm using SharePoint 2010 Standard Edition.

The filter seems to work; when page load only filtered items are displayed. When I click multiselect Add Button the selected item moves from left listbox to right listbox.

When I click Multiselect Remove Button the selected item moves from right listbox to left listbox, but in the left listbox appears all items without filter. If I reload page the filter works correctly,

Could you help me, please? Thank you

 

Matteo

Coordinator
Jun 8, 2011 at 3:22 AM

Matteo:

Can you show me the call to SPFilterDropDown which you are using? Are you using SPFilterDropDown in conjunction with any other SPServices functions, or just by itself?

M.

Jun 8, 2011 at 7:52 AM

Hi sympmarc,

the call is the following:

<script type="text/javascript">
        $(document).ready(function () {
            var idProj = gup('IDProj');

            $("input[title='IDProgetto']").val(idProj);
                      
            $().SPServices.SPFilterDropdown({
                relationshipList: "Attività",
                relationshipListColumn: "Title",
                columnName: "Valori possibili Predecessori",
                CAMLQuery: "<Eq><FieldRef Name='IDProgetto'/><Value Type='Number'>" + idProj + "</Value></Eq>",
                completefunc: null,
                promptText: "",
                debug: true
            });
           
            $().SPServices.SPSetMultiSelectSizes({
                multiSelectColumn: "Valori possibili Predecessori"
            });
        });

        function gup(name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regexS = "[\\?&]" + name + "=([^&#]*)";
            var regex = new RegExp(regexS);
            var results = regex.exec(window.location.href);
            if (results == null)
                return "";
            else
                return results[1];
        }
    </script>

I'm using the function SPSetMultiSelectSizes also, but if I delete this function issue is the same.

Function gup is used to retrieve querystring parameter value for CAML query.

Thank you for your help!

 

Matteo

Coordinator
Jun 13, 2011 at 1:39 PM

Matteo:

I'm going to look into this further, but it may be a bug.

M.

Coordinator
Jun 13, 2011 at 1:40 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 13, 2011 at 5:23 PM
Edited Jun 13, 2011 at 9:51 PM

Nevermind this post, it's not accurate...

Is this a bug or is the QS variable out of scope?

The var idProj = gup('IDProj'); is set during $(doc).ready.  After that function is complete that variable is "destroyed".  I wonder if this would work correctly if you implicitly declared the variable instead of explicitly declaring the variable.  IOW:

 

<script type="text/javascript">
        $(document).ready(function () {
//Changed this line
            idProj = gup('IDProj');
//End
            $("input[title='IDProgetto']").val(idProj);
                       
            $().SPServices.SPFilterDropdown({
                relationshipList: "Attivit�",
                relationshipListColumn: "Title",
                columnName: "Valori possibili Predecessori",
                CAMLQuery: "<Eq><FieldRef Name='IDProgetto'/><Value Type='Number'>" + idProj + "</Value></Eq>",
                completefunc: null,
                promptText: "",
                debug: true
            });
            
            $().SPServices.SPSetMultiSelectSizes({
                multiSelectColumn: "Valori possibili Predecessori"
            });
        });

        function gup(name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regexS = "[\\?&]" + name + "=([^&#]*)";
            var regex = new RegExp(regexS);
            var results = regex.exec(window.location.href);
            if (results == null)
                return "";
            else
                return results[1];
        }
    </script>
Coordinator
Jun 20, 2011 at 4:58 PM

Matteo:

This issue should be fixed in v0.6.2ALPHA7. If you have a chance to test it, that would be great. I should be releasing v0.6.2 imminently.


M.

Jul 5, 2011 at 9:58 AM

Hello sympmarc,

excuse me if I reply only today, but I worked on other projects and I tried only now v0.6.2.

Unfortunately, the problem persist even with new version. When I click "Remove" the left listbox loses filter over its elements.

 

Thank you for your support

 

Matteo

Coordinator
Jul 5, 2011 at 2:28 PM

Matteo:

Sorry that it isn't working for you yet. What version of jQuery are you using?

M.

Jul 5, 2011 at 4:29 PM

I tested it with jQuery 1.5.1 and 1.6.2.

 

Thanks!

 

Matteo

Coordinator
Jul 5, 2011 at 7:36 PM

Matteo:

I think we're going to have to come up with a way for you to send me a test case. Can you share your lists/site via template(s)?

Also, is your site running in Italian? (I'm guessing based on the values above.) It's possible that is causing an issue which I don't see on my end.

M.

Jul 30, 2012 at 10:28 PM

Hello,

 

Im having same problem.

 <script type="text/javascript">
        $(document).ready(function () {        
        
            $().SPServices.SPFilterDropdown({
                relationshipList: "UF",
                relationshipListColumn: "UF",
                columnName: "UFs pertencentes possible values",
                noneText: "NULL",
                CAMLQuery: "<Eq><FieldRef Name='Utilizado' /><Value Type='Boolean'>0</Value></Eq>",
                debug: true
            }); 
</script>

 

When i clicked in remove, my list losses the filter.

Can u help me?

Coordinator
Jul 31, 2012 at 3:09 AM

guilhermemmb:

This was an issue last year in an earlier version, but shouldn't be any longer. What version of jQuery and SPServices are you using? Are you using a language pack other than English?

M.

Jul 31, 2012 at 3:46 AM

Hi,

 

Im using spservice 0.7.1 and jquery 1.7.2 .

And my problem is the same.


When i select any option in "selected values"  and clicked in remove, my "select possible values" was rebinded this select with my lookup list without any filter.

 

And im not using another language pack.

Jul 31, 2012 at 3:54 AM

How is the best(or only) way to apply lookupmulti with filter with spfilterdropdown??


Im using custom newForm.aspx , and inside that where im putting my javascript (already shown above)