Home › Forums › SPJS-Lookup › Web Part Dropdown list filter?
Tagged: Dropdown lookup
- This topic has 2 replies, 2 voices, and was last updated 9 years, 4 months ago by Alexander Bautz.
-
AuthorPosts
-
-
April 15, 2015 at 07:06 #7406
Hi Alexander,
I’m trying to use this on a web part page, not on a New or Edit form page as a webpart dropdown filter that is connected to a List Web Part on the same page.
Can you please advise if this can be done by replacing the Single-line Text Field to for example a HTML Form Web Part?
If not, which solution could I use that can do this?
I’m currently using a manual HTML Form Web part to display a drop down of names, like this post: http://www.sharepointbinder.com/1/post/2012/02/filters.html but I would like to do this dynamically.
Thanks,
Brett
- This topic was modified 9 years, 8 months ago by Brett.
-
July 22, 2015 at 07:30 #7972
Hi Alexander,
Any ideas what I can do here for this?
I have scoured the web and I can’t seem to locate any JQuery solution that can provide a dropdown column webpart which then filters another List Web Part on a Web Part Page.
I found this: http://modery.net/providing-filter-dropdowns-for-a-sharepoint-listlibrary-with-jquery/
But it needs to be placed above a List View.Thanks,
Brett
-
July 28, 2015 at 18:30 #8001
Hi,
Sorry for the delay. I tried to attach a script generated select to a list view, but it didn’t work as the page refreshed when I tried to filter the view – resulting in the select falling back to the default value returned from the query.If you want to try it out yourself, here is the code I tried to use in the HTML form web part:
<select id="myCustomListFilterDropdown" name="T1"></select><input type="button" value="Go" onclick="javascript:_SFSUBMIT_"/> <script type="text/javascript" src="/SPJS/DFFS/plugins/jquery.js"></script> <script type="text/javascript" src="/SPJS/DFFS/plugins/SPJS-utility.js"></script> <script type="text/javascript"> var oRes = spjs_QueryItems({"listName":"Dummy","listBaseUrl":"/DFFS","query":"<Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where>","viewFields":["ID","Title"]}); if(oRes.count < 0){ alert("Query failed, please check your parameters"); }else{ var b = []; $.each(oRes.items,function(i,item){ b.push("<option value='"+item.ID+"'>"+item.Title+"</option>"); }); $("#myCustomListFilterDropdown").append(b.join("")); } </script>
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.