I have a web page that is a customized list item form that contains editable "master" entry details and an XSLT list view for showing associated "detail" records. I am struggling with properly initializing an XSLT List View's column filter with desired default settings upon loading the web page.

Here are the options I have already tried with no luck so far:

  1. Using the clause in the CAML query. This does the job but at the same time effectively disables any further column filtering for the user.
  2. Using the Query String Filter Web Part with a pre-defined default value. This almost does the job except for the "Clear Filter" option because obviously the Query String Filter does not react to the ClearFilter query string parameter.

  3. Passing necessary filter values in the query string parameters (e.g. FilterField1=...&FilterValue1=...). This option works fine, however the problem is that there seems to be no easy way to pass these query string parameters to the page from the "Edit Item" ECB menu item.

As for the ECB menu, I got as far as completely overriding the JavaScript code that constructs the ECB menu and "hacked" it in a way that I append the necessary query string params to the URL passed by SharePoint to the EditItem2 JS function call.

If only that worked... turns out, the EditItem2 call sends the user to the "listform.aspx" page that, in turn, redirects the user to my page, but unfortunately now without the additional query string params.

Of course I can hack the ECB menu construction routine even further so it sends the user directly to my page, bypassing the listform.aspx one. But I have very limited experience in SharePoint so I am not sure what side effects this might cause.

Is this the only (and at all a correct) way to initialize the column filter? Unfortunately I couldn't google anything useful on the subject matter so I hope to get some insights from the community.

Thanks in advance!

1 Answer 1


Add the following script to your page:

if (GetUrlKeyValue("FilterField1")=='' && GetUrlKeyValue("FilterClear")=='') _FilterField(GetUrlKeyValue("View"), "DEFAULT_FILTER_FIELD", "DEFAULT_FILTER_VALUE", 1)

replacing DEFAULT_FILTER_FIELD and DEFAULT_FILTER_VALUE placeholders with your values. This script reloads the page with default filter for the first time and allows following usage of the filtering commands

  • Do I understand correctly that this is client-side code?
    – DmytroL
    Mar 22, 2015 at 20:47
  • Yes, it's a client-side code. You can deploy it using Content Editor Web part. Mar 23, 2015 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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