Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Issues with remote paging and sorting in igGrid
posted

I am using a sample jQuery MVC project in VS 2012 with IgniteUI 2013.1. When I set the paging on igGrid to be remote, the grid only shows first page of N and clicking next page does nothing. Similarly, when filtering is set to remote, nothing happens but if I set  it to local, it works fine on the currently selected page.

 View code:

@(Html.Infragistics().Loader()
.ScriptPath(Url.Content("~/Infragistics/js/"))
.CssPath(Url.Content("~/Infragistics/css/"))
.Render()
)

<h2>Grid</h2>
@(Html.Infragistics().Grid(Model)
.Features(x =>
{
x.Paging().PageSize(25).Type(OpType.Remote);
x.Filtering().Mode(FilterMode.Simple).Type(OpType.Remote);
x.Sorting().CaseSensitive(false);
})
.DataBind()
.Render()
);

Controller:

public class HomeController : Controller
{
readonly MyStuffContext _db = new MyStuffContext();
//
// GET: /Home/

public ActionResult Index()
{
return View(_db.Books.OrderBy(x => x.Id));
}

}

Where MyStuffContext is a DBContext created using EF:

public class MyStuffContext : DbContext
{
public DbSet<Movie> Movies { get; set; }
public DbSet<Book> Books { get; set; }
}

  • 23953
    Verified Answer
    Offline posted

    Hello Mensur,

    Remote grid features require to set DataSourceUrl() in the grid configuration and also define a controller action which will process the remote operations.

    The controller action should have "GridDataSourceAction" attribute.

    Here is an example code:

    View code:
    @(Html.Infragistics().Grid(Model)
    .Features(x =>
    {
    x.Paging().PageSize(25).Type(OpType.Remote);
    x.Filtering().Mode(FilterMode.Simple).Type(OpType.Remote);
    x.Sorting().CaseSensitive(false);
    })
    .DataSourceUrl(Url.Action("GetData"))
    .DataBind()
    .Render()
    );

    Controller code:
    [GridDataSourceAction]
    public ActionResult GetData()
    {
    return View(_db.Books.OrderBy(x => x.Id));
    }

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc.