我使用VS 2010中的列表定义+列表实例创建了一个列表。我还为列表创建了列表视图。当我为除“所有项目”视图以外的自定义视图添加“分组依据”和“分页”属性时,它不会按自定义视图的属性更新分页和分组。
这是schema.xml
中的视图部分<Views>
<View DisplayName="All Items" DefaultView="TRUE" BaseViewID="1" Type="HTML" MobileView="TRUE" MobileDefaultView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="AllItems.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<OrderBy>
<FieldRef Name="Title" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="LinkTitleNoMenu" />
<FieldRef Name="Property_x0020_Type" />
<FieldRef Name="Hotel_x0020_Status" />
<FieldRef Name="Union" />
<FieldRef Name="Local_x0020_Number" />
<FieldRef Name="Comments" />
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="All By Hotel name" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="All By Hotel name.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Title" />
</GroupBy>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="Property_x0020_Type" />
<FieldRef Name="Hotel_x0020_Status" />
<FieldRef Name="Union" />
<FieldRef Name="Local_x0020_Number" />
<FieldRef Name="Comments" />
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="By Hotel Status" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="By Hotel Status.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Hotel_x0020_Status" />
</GroupBy>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="Property_x0020_Type" />
<FieldRef Name="Hotel_x0020_Status" />
<FieldRef Name="Union" />
<FieldRef Name="Local_x0020_Number" />
<FieldRef Name="Comments" />
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="By Hotel Union" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="By Hotel Union.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Union" />
</GroupBy>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="Property_x0020_Type" />
<FieldRef Name="Hotel_x0020_Status" />
<FieldRef Name="Union" />
<FieldRef Name="Local_x0020_Number" />
<FieldRef Name="Comments" />
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="By Local number" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="By Local number.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Local_x0020_Number" />
</GroupBy>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="Property_x0020_Type" />
<FieldRef Name="Hotel_x0020_Status" />
<FieldRef Name="Union" />
<FieldRef Name="Local_x0020_Number" />
<FieldRef Name="Comments" />
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="Summary" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Summary.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="Property_x0020_Type" />
<FieldRef Name="Hotel_x0020_Status" />
<FieldRef Name="Union" />
<FieldRef Name="Local_x0020_Number" />
<FieldRef Name="Comments" />
</ViewFields>
<RowLimit Paged="TRUE">3</RowLimit>
<Aggregations Value="Off" />
</View>
</Views>
当我部署列表时,自定义视图没有附加的分页或分组。
答案 0 :(得分:3)
因为您在每个视图中使用相同的BaseViewID。您必须在每个视图上增加它。 您还应该更改视图中的URL值,以便能够从列表中的下拉菜单中选择此视图。