Hi,
I had a very annoying bug in our application. I'm using the grid with mvc helper. I followed the same example of this link: https://www.igniteui.com/grid/aspnet-mvc-helper . When I use this method, there is an error with datetime filter. My filter is local.
I saw a similar issue here:
https://www.infragistics.com/community/forums/f/ignite-ui-for-javascript/89414/date-filter-is-not-working-for-remote-filtering
I debugged your infragistic.core.js, the error is coming from date interpretation. I have a value like:
_findDateMatch: function(val, expr, cond, preciseDateFormat) { => val = "/Date(1479387370018)/", expr = Tue Nov 15 2016 00:00:00 GMT+0100
expr is the search value
val is the grid value.
There is a bug of retrieving grid value. This error only occur when I use the mvc helper. The same grid with GridModel or with javascript would work fine.
This is a very blocking issue for us, I already passed a day for find the reason. Now I try another solution. Can you give me another solution how can I avoid this please?
Here is the example. My Grid is very simple:
Index.cshtml:
@(Html.Infragistics()
.Grid<TestCountryModel>()
.ID("pcd-grid")
.AutoGenerateColumns(false)
.RenderCheckboxes(true)
.PrimaryKey("CountryId")
.EnableUTCDates(false)
.Columns(column =>
{
column.For(x => x.Code).Width("10%").DataType("string");
column.For(x => x.Name).Width("10%").DataType("string");
column.For(x => x.CountryDate).Width("8%").DataType("date");
})
.Features(features =>
features.Sorting().Type(OpType.Local).Persist(true);//.Mode(SortingMode.Multiple);
features.Paging().Type(OpType.Local).PageSize(25);
features.Filtering().Type(OpType.Local);
features.GroupBy().Type(OpType.Local).Persist(true).GroupByDialogContainment("window");
features.Updating()
.EditMode(GridEditMode.Cell)
.StartEditTriggers(GridStartEditTriggers.Click)
.EnableDeleteRow(false)
.EnableAddRow(false)
.ShowDoneCancelButtons(true);
features.Tooltips().ColumnSettings(cs =>
cs.ColumnSetting().ColumnKey("IsNotValid").AllowTooltips(true).MaxWidth(500);
cs.ColumnSetting().ColumnKey("Code").AllowTooltips(true).MaxWidth(500);
cs.ColumnSetting().ColumnKey("Name").AllowTooltips(false);
cs.ColumnSetting().ColumnKey("CountryDate").AllowTooltips(false);
.Visibility(TooltipsVisibility.Always)
.HideDelay(100)
.ShowDelay(300);
features.Resizing();
// Column show or hide feature
features.Hiding();
.DataSourceUrl(Url.Action("CandidatesGrid", "DateTime"))
.Render())
Model:
public class TestCountryModel
public int CountryId { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public DateTime CountryDate { get; set; }
}
Controller:
[GridDataSourceAction]
public ActionResult CandidatesGrid()
var model = new List<TestCountryModel>()
new TestCountryModel(){
CountryId = 1,
Code = "C1",
Name = "Country 1",
CountryDate = DateTime.Now
},
CountryId = 2,
Code = "C2",
Name = "Country 2",
CountryDate = DateTime.Now.AddDays(1)
CountryId = 3,
Code = "C3",
Name = "Country 3",
CountryDate = DateTime.Now.AddDays(2)
};
return View(model.AsQueryable());
And try to filter on datetime.
Hello Cem,
It looks like that the igGrid doesn't do schema transformation (this forces the grid to convert the data source value to the type configured in the grid column configuration). Try adding the following configuration to your code MVC code:
.LocalSchemaTransform(true)
Best regards, Martin Pavlov Infragistics, Inc.
Hi Martin,
Thank you very much for your answer, it just worked.
Regards
You're welcome!
Best regards,Martin PavlovInfragistics, Inc.