PageProxy分页的实现

PageProxy是Ext.Net实现的一种分页方式,PageProxy通过实现OnReadData事件来完成分页。

<ext:Store runat="server" ID="storeUserInfo" PageSize="6" OnReadData="storeUserInfo_ReadData">
    <Model>
        <ext:Model ID="Model1" runat="server" IDProperty="Name" >
            <Fields>
                <ext:ModelField Name="Name" Type="String"></ext:ModelField>
                <ext:ModelField Name="Gender" Type="String"></ext:ModelField>
                <ext:ModelField Name="Age" Type="Int"></ext:ModelField>
            </Fields>
        </ext:Model>
    </Model>
    <Proxy>
        <ext:PageProxy></ext:PageProxy>
    </Proxy>
</ext:Store>

然后再后台代码中实现storeUserInfo_ReadData:

protected void storeUserInfo_ReadData(object sender, Ext.Net.StoreReadDataEventArgs e)
{
    int start = e.Start;
    int limit = e.Limit;

    var userInfoList = UserInfo.GetData();
    e.Total = userInfoList.Count;

    storeUserInfo.DataSource = userInfoList.Skip(start).Take(limit).ToList();
    storeUserInfo.DataBind();
}

 

posted @ 2016-05-18 14:56  苍穹丶  阅读(441)  评论(0编辑  收藏  举报