5

I would like to dynamically construct a couple of URLs for our SharePoint users to filter down a rather large list view we have. Rather than create a bunch of different custom views, I was wondering if there is a way to just pass some URL arguments to the AllItems.aspx page and have the filter be applied during page load.

I envision maybe create a text box where they can type a question like "DocumentID" and give it a value of "12345" - then have javascript construct an appropriate URL like:

http://server/site/Lists/Links/AllItems.aspx?MyFilter=DocumentID:12345
12

If you filter manually, you'll see that the URL changes, e.g. to something like

http://server/site/Lists/Links/AllItems.aspx?FilterField1=DocumentID&FilterValue1=650

So if you pass the parameters FilterField1 and FilterValue1 accordingly, it should work.

  • This worked like a charm - exactly what I was looking for. Thanks! – Goyuix Jun 25 '10 at 15:04
  • it's don't work when you have to filter multiples lists – user9181 Jun 29 '12 at 1:03
1

I wouldn't recommend customizing a regular SharePoint view page in this way. You could create another page though outside of the list or library and put a dataview on there that uses the URL input property.

  • Can you elaborate ? – frenchone Mar 29 '17 at 8:29
  • 1
    @frenchone, Mike is saying that it is not best practice to edit pages in the /Lists/MyList/ directory of a site. Instead, create a page in the Site Pages or Pages libraries and add a List View Web part of the desired list. From there you can add whatever you want to the page safely. – ExceptionLimeCat Dec 12 '17 at 20:00
  • That's more clear. But: OP does not edit pages he filters existing list using url. I guess OP want a dynamic filter, this can't be done using LVWP (or can it ?) And if this can be done, how would it be different (/better) from directly filtering through url filter ? – frenchone Dec 13 '17 at 8:55
1

To use the query string parameters as filters you can use the Query String Filter Web Part and connect to a List View Web Part on a Web Part page.

  • 1
    Keep in mind that the Filter Web Parts require an Enterprise license. – Mike Oryszak Jun 25 '10 at 0:49
  • Query String Filter Web Part definitely the way to go (if available to you). – matt Sep 3 '15 at 18:52
1

Heres a post i wrote to demonstrate how we can filter a SharePoint list view web part with JavaScript.

Uses the same concept as suggested by Modery

http://rahul-vartak.blogspot.com/2010/08/sharepoint-2007-filtering-list-view-web.html

Hope this is useful..:)

1

Hi this was a useful post ( I know it is old but I found it!), but I ran into problems with my URL and characters that the string builder didn't like - the 'you cant have [%%]' error message

My link was this kind of thing:

http://foobar/Lists/ECR%20System%20Build/AllItems.aspx?View={by%20ECR%20status}#InplviewHashf777aa1d-dde8-4d51-b8d1-18b514c226f9=FilterField1%3DECR%255Fx0020%255FID-FilterValue1%3D417 (where 417 was the ID in my lookup list)

I already had a lot of rows and wanted to fix them up retrospectively. The concatenation idea didn't seem to work for me.

so I did this (after copying a filtered view URL that worked and adapting it)

I made a string type workflow variable:

then set variable systemslink to    http://collaborate/sites/trustwide/openriocomm/Lists/ECR System Build/AllItems.aspx?View=All Items#InplviewHashf777aa1d-dde8-4d51-b8d1-18b514c226f9=FilterField1=ECR%255Fx0020%255FID-FilterValue1=[%Current Item:ID%], my hyperlink label

then I copied that variable value into my destination hyperlink type column Systems view:

.. then set Systems view to Variable:systemslink

and this worked beautifully, when added to my 'on creation' workflow.

to fix up the others I used an MS access update query, where the syntax is quite different:

UPDATE [ECR Tracker] SET [ECR Tracker].[Systems view] = "See System Build(s)#http://foobar/Lists/ECR%20System%20Build/AllItems.aspx?View={by%20ECR%20status}#InplviewHashf777aa1d-dde8-4d51-b8d1-18b514c226f9=FilterField1%3DECR%255Fx0020%255FID-FilterValue1%3D" & [ID] & "#";

Hope this helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.