简体   繁体   中英

List definition - View for AllItems.aspx - How can i display the view with all items and then let the user filter the results

I have a list definition with a custom form to display all my list items.

I have added 2 controls to filter my view. I want these only to affect the results once the user has chosen a value. Currently the view is being filtered by the default values of the control and not displaying all the items. Should i alter the caml to allow this?

 <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE"
        MobileDefaultView="TRUE"
        SetupPath="pages\toyotatemplate\marketpgviewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx" >
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">10</RowLimit>
    <ViewFields>
      <FieldRef Name="LinkTitle" ></FieldRef>
      <FieldRef Name="MarketplaceCategories"></FieldRef>
      <FieldRef Name="Author"/>
      <FieldRef Name="Created" Format="{dd/mm/yyyy}"/>
      <FieldRef Name="MarketplaceSubCategories"></FieldRef>
      <FieldRef Name="Locations"></FieldRef>
      <FieldRef Name="MarketplaceItemExpiryDate" Format="{dd/mm/yyyy}"></FieldRef>
    </ViewFields>
    <Query>
      <OrderBy>
        <FieldRef Name="ID" Ascending="False" />
      </OrderBy>
    </Query>
    <ParameterBindings>
      <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
      <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
      <ParameterBinding Name="MarketplaceCategories" Location="Control(tcCategories, SelectedItem)"/>
      <ParameterBinding Name="MarketplaceSubcategories" Location="Control(tcSubCategories, SelectedItem)"/>
    </ParameterBindings>
  </View>

To achieve this, I created 2 views:

  1. AllItems.aspx
  2. FilteredItems.aspx.

My control redirects to FilteredItems.aspx on the PostBack and keeps the selected value. The CAML uses the selected value to filter the view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM