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
2060
Setting igGrid column DataType to date stops the grid being updateable
posted

This is a weird one, when I look at the view below the data loads and the new row can be used, but the whole rest of the grid turns grey when I hover over it and there's only one 'x' delete button on the middle row

@(Html.Infragistics()
.Grid(Model)
.ID("grid1")
.PrimaryKey(nameof(LuInspectionWindow.InspectionWindowId))
.UpdateUrl(Url.Action("UpdatingSaveChanges", "InspectionWindow"))
.AutoGenerateLayouts(false)
.AutoCommit(true)
.Columns(column =>
{
column.For(x => x.Description).HeaderText("Description").DataType("string");
column.For(x => x.StartDate).HeaderText("Start Date").DataType("date");
//column.For(x => x.EndDate).HeaderText("End Date").DataType("date").Format("dd/MM/yyyy");
})
.Width("600px")
.Height("500px")
.Features(features =>
{
features.Updating()
.EditMode(GridEditMode.Row)
.EnableDeleteRow(true)
.EnableAddRow(true)
.ColumnSettings(settings =>
{
settings.ColumnSetting().ColumnKey(nameof(LuInspectionWindow.Description))
.EditorType(ColumnEditorType.Text).Required(true).Validation(true);
settings.ColumnSetting().ColumnKey(nameof(LuInspectionWindow.StartDate))
.EditorType(ColumnEditorType.Date).Required(false).Validation(false);
//settings.ColumnSetting().ColumnKey(nameof(LuInspectionWindow.EndDate))
// .EditorType(ColumnEditorType.DatePicker).Required(true).Validation(true);
});

})
.DataSourceUrl(Url.Action("GetGridData", "InspectionWindow"))
.DataBind()
.Render())

However, if change the DataType for the Start Date column to string, then the grid contents become editable, but the dates are then shown in the wrong format (I'm in the UK, so looking for format dd/MM/YYYY)

I'm assuming that the data is loading correctly as the grid is populated.  The data source is an IQueryable of these:

public partial class LuInspectionWindow
{
[Required]
public int InspectionWindowId { get; set; }
[Required]
public string Description { get; set; }
[Required]
[DataType(DataType.Date)]
public DateTime StartDate { get; set; }
[Required]
[DataType(DataType.Date)]
public DateTime EndDate { get; set; }
}

If I look at the console I can see this error when I try and click on one of the cells to try and edit:

 

infragistics.lob.js:495 Uncaught Error: The specified record or property was not found. Verify the criteria for your search and adjust them if necessary.
at $.(anonymous function).(anonymous function)._getLatestValues (https://cdn-na.infragistics.com/igniteui/2016.2/xxx/xxx/js/infragistics.lob.js:495:808)
at $.(anonymous function).(anonymous function)._getLatestValues (https://localhost:44307/lib/jquery-ui/jquery-ui.js:144:25)
at $.(anonymous function).(anonymous function)._startEditForRow (https://cdn-na.infragistics.com/igniteui/2016.2/xxx/xxx/js/infragistics.lob.js:493:29009)
at $.(anonymous function).(anonymous function)._startEditForRow (https://localhost:44307/lib/jquery-ui/jquery-ui.js:144:25)
at $.(anonymous function).(anonymous function)._startEditForElement (https://cdn-na.infragistics.com/igniteui/2016.2/xxx/xxx/js/infragistics.lob.js:493:26680)
at $.(anonymous function).(anonymous function)._startEditForElement (https://localhost:44307/lib/jquery-ui/jquery-ui.js:144:25)
at $.(anonymous function).(anonymous function)._clickTrigger (https://cdn-na.infragistics.com/igniteui/2016.2/xxx/xxx/js/infragistics.lob.js:493:13512)
at $.(anonymous function).(anonymous function)._clickTrigger (https://localhost:44307/lib/jquery-ui/jquery-ui.js:144:25)
at HTMLTableCellElement.proxy (https://localhost:44307/lib/jquery/dist/jquery.js:496:14)
at HTMLDivElement.dispatch (https://localhost:44307/lib/jquery/dist/jquery.js:5206:27)

Any ideas what I'm doing wrong?