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
905
igGrid paging is not working correctly with VS2017/.NET Core 2.0
posted

I've included the code to the model/view/controller of a VS2017 .Net Core 2.0 MVC test project (sorry about the formatting...)
I'd originally thought the problem occurred when I called igGrid.('dataBind') (for which I've included a test button in the view), but clicking "Next" on the grid pager produces the same result:

Steps to reproduce:
When the page/grid is first loaded, the pager displays "1 - 10 of 100 records" and the grid correctly displays the first 10 records
After clicking the pager "Next" button, the pager displays "11 - 20 of 100 records", but all 100 records are being displayed in the grid
The 100 test records now remain, no matter which of the pager buttons are clicked

The QueryString (highlighted below) contains {page=1&pageSize=10&$select=Id%2cDescription&pk=Id&_=1513295210414} - the correct page and page size

I thought maybe I'd missed a breaking change for .net core 2.0, but the code follows what is posted at https://www.igniteui.com/help/iggrid-paging

BTW: On the page for the link above, I'm fairly certain
    return View(this.GetCustomers().AsQueryable());
should be
   
return View(this.GetProducts().AsQueryable());


My Environment:
Visual Studio 2017 (15.5.2)
IgniteUI (17.2.412)
Infragistics.Web.AspNetCore (6.17.2.183)

Thank you!


using System.Collections.Generic;

using System.Collections.Specialized;

using System.Linq;

using System.Web;

using IgTestDataBind.Models;

using Infragistics.Web.Mvc;

using Microsoft.AspNetCore.Mvc;

namespace IgTestDataBind.Controllers

{

public class TestController : Controller

{

public IActionResult Index()

{

var model = GenerateTestData();

return View(model);

}

[GridDataSourceAction]

public IActionResult GetData()

{

NameValueCollection queryString = HttpUtility.ParseQueryString(Request.QueryString.ToString());

var model = GenerateTestData();

return View(model);

}

private static IQueryable<TestIgModel> GenerateTestData()

{

var data = new List<TestIgModel>();

for (var x = 1; x <= 100; x++)

{

data.Add(new TestIgModel

{

Id = x,

Description = $"Test Rec {x}"

});

}

return data.AsQueryable();

}

}

}


@using Infragistics.Web.Mvc

@model IQueryable<TestIgModel>

@{

ViewData["Title"] = "igGrid Test";

}

<div class="row" style="padding: 20px 0;">

<div class="col-md-12">

<div id="igGrid"></div>

</div>

</div>

<button id="btnDataBind" class="btn btn-default">call igGrid('dataBind')</button>

@section Scripts

{

<script>

$(function()

{

$('#btnDataBind').click(function()

{

$('#igGrid').igGrid("dataBind");

});

});

</script>

@(Html.Infragistics().Grid(Model)

.ID("igGrid")

.Height("500px")

.PrimaryKey("Id")

.Caption("Test igGrid DataBind")

.AutoGenerateColumns(false)

.AutoGenerateLayouts(false)

.ShowHeader(true)

.FixedHeaders(true)

.Columns(column =>

{

column.For(x => x.Id).Width("80px");

column.For(x => x.Description);

})

.Features(f =>

{

f.Filtering()

.Mode(FilterMode.Simple);

f.Paging()

.PageSize(10)

.PageSizeDropDownLocation("inpager");

f.Resizing();

f.Responsive();

f.Selection()

.Mode(SelectionMode.Row);

f.Sorting()

.Mode(SortingMode.Single);

})

.DataSourceUrl(Url.Action("GetData"))

.DataBind()

.Render())

}


namespace IgTestDataBind.Models

{

public class TestIgModel

{

public int Id { get; set; }

public string Description { get; set; }

}

}

Top Replies