Web Part Dropdown list filter?

Home Forums SPJS-Lookup Web Part Dropdown list filter?

Viewing 2 reply threads
  • Author
    Posts
    • #7406
      Brett
      Participant

        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.
      • #7972
        Brett
        Participant

          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

        • #8001
          Alexander Bautz
          Keymaster

            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

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.