开发者

Pagination and group by for Custom views created using list definition not working

I created a list using the list definition + list instance from VS 2010. I also created the list views for the list. When I add Group by and paging properties for custom views other than All Items view then it is not updating the paging and group by properties for custom views.

Here is my view section in 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>

When I deploy the list the custom views has no pagination or group by attached to it.


Because you use the same BaseViewID in each view. You must increment it on each view. You should also change the URL value in view to be able to select this view from drop down menu in list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜