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
25
data-id = "undefined"
posted

Hello!

I've tried to create a Grid with some columns, and after I add a column with dateTime type, here "CreatedOn" all row's data-id parameter became "undefined", so I can't edit the table.

(Html.Infragistics()
.Grid(Model)
.ID(viewID + "Grid")
.Width("100%")
.Height("500px")
.PrimaryKey("ID")
.AutoGenerateColumns(false)
.AutoGenerateLayouts(false)
.Columns(column =>
{
column.For(x => x.InvoiceNumber).HeaderText("Invoice #").DataType("string").Width("75px");
column.For(x => x.StatusID).HeaderText("Status").DataType("number").Width("auto").FormatterFunction("formatStatusCombo");
column.For(x => x.CreatedOn).HeaderText("Invoice Date").DataType("date").Width("auto").Format("dd/MM/yyyy");

})
.Features(features =>
{
features.Updating().ColumnSettings(cs =>
{

cs.ColumnSetting().ColumnKey("InvoiceNumber").ReadOnly(true);
cs.ColumnSetting().ColumnKey("CreatedOn").ReadOnly(true);
cs.ColumnSetting().ColumnKey("StatusID").ReadOnly(false).Required(true).EditorType(ColumnEditorType.Combo).EditorOptions("mode: 'dropdown', dataSource: Statuses, textKey: 'Status', valueKey: 'ID'");
})
.EditMode(GridEditMode.Row)
.EnableAddRow(false)
.EnableDeleteRow(false);
.DataSourceUrl(Url.Action("GetAllForGrid"))
.UpdateUrl(Url.Action("SaveGrid"))
.DataBind()
.Render()
)

Everything shows up right, I just can't edit the Status... If I remove the CreatedOn column works fine. 

Parents
No Data
Reply
  • 23953
    Offline posted

    Hello Attila,

    The presence of date type column in the grid column definitions changes the LocalSchemaTransform option from false to true implicitly(the reason is that the serialized date column needs to be correctly transformed on the client). This results in serializing only the columns present in the grid column definition back to the client(browser). In order to fix this you should include your "ID" column (and make it hidden) in the grid columns definitions so it gets serialized.

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc.

Children
No Data