2

Another day, another strange request from end users :)

My problem is simple = they want a search page, with multiple combobox/dropdownlist/managed metadata picker and a single search button. Advanced search page ? No, because users want to see search results directly in documents library view and not search results page :(

At first glance, i'm thinking about tweaking a search results page to look like a document view library. Unfortunately, i know that losing the ribbon can be a huge problem on the future.

Once upon a time, with SharePoint 2010, I was able to dynamically build query string for filter a view. I'm looking for a reference or finely documented blog post about it for SharePoint 2013

1
  • Do you want to deploy the list view using feature/module?
    – users1100
    Jun 8 '15 at 4:32
1

If you are deploying the list definition then in Schema.xml file you have to create a new view declaratively.

Below is the sample xml for view:

  <View BaseViewID="13" Type="HTML" WebPartZoneID="Main" DisplayName="Incident" DefaultView="FALSE" MobileView="TRUE" MobileDefaultView="FALSE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/generic.png?rev=23" Url="FilteredActions.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <JSLink>clienttemplates.js</JSLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
      <FieldRef Name="LinkTitle"></FieldRef>         
    </ViewFields>
    <Query> // here the query to filter the data falls.
      <Where>
          <Eq>
            <FieldRef Name="Incident" LookupId="TRUE" />
            <Value Type="Lookup">{IncidentId}</Value>
          </Eq>
      </Where>
      <OrderBy>
        <FieldRef Name="ID"></FieldRef>
      </OrderBy>
    </Query>
    <ParameterBindings>
      <ParameterBinding Name="IncidentId" Location="QueryString(IncidentId)" DefaultValue="0"/>
      <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
      <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    </ParameterBindings>
  </View>

You can copy the any existing view's schema (for example: AllItems). Add new Parameter in <ParameterBinding>. Define the name of the Query String parameter you are going to pass. In <Query> tag you can filter the records using CAML query. To get the value of query string parameter in {<QPName}.

Hope this helps to solve your query.!!

1
  • I'm trying to use FilterValue and FilterField query string directly on URL. It seems to be OK with managed metadata !
    – alxsbn
    Jun 15 '15 at 14:29

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.