网格的页面大小不会改变

时间:2015-09-13 09:18:24

标签: asp.net-mvc razor devexpress devexpress-mvc

我使用Devexpress网格,我有一个下拉列表,用于更改网格中的行数。但是网格中的行数不会改变。我把断点放在网格的.cshtml文件中,我看到变量pageSize有新值,但网格不会改变。哪里可能是问题?

这是我网格定义的一部分:

@{  
    int initialSize = 10;
    int pageSize = ViewBag.PageSize ?? initialSize;
    var grid = Html.DevExpress().GridView(
        settings =>
        {
            settings.Name = "gvCompanies";
            settings.Width = 960;
            settings.CallbackRouteValues = new { "Company", Action = "AllCompanies" };
            settings.SettingsPager.Mode = GridViewPagerMode.ShowPager;
            settings.SettingsPager.PageSize = pageSize;
            settings.ClientSideEvents.BeginCallback = "CompanyBeginCallback";

            //... more settings

            //column definiton
        } );
    if ( Model != null )
    {
        grid.Bind( Model ).GetHtml();
    }
    else
    {
        grid.GetHtml();
    }
}

下拉更改事件功能:

function ChangeRowsPerPage(s, e)
{
    s.Refresh();        
}

网格开始回调函数:

function CompanyBeginCallback(s, e) {
    e.customArgs["rowsPerPage"] = rowsCount.GetValue();
}

控制器方法:

public ActionResult AllCompanies( int? rowsPerPage )
{
    //..some code
    ViewBag.PageSize = rowsPerPage;
    return PartialView( "CompanyGVPartial", data );
}

0 个答案:

没有答案