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
155
Hiding Error in 15.2 MVC
posted

I upgraded to 15.2. After the update it is no longer allowing me to hide columns. I am getting the following console error:

Uncaught TypeError: Cannot read property 'key' of undefined

I attached my code below:

@(Html.Infragistics()
.Grid(Model)
.ID("CAMExpenseListGrid")
.AutoGenerateColumns(false)
.PrimaryKey("Id")
.RenderCheckboxes(true)
.AutoCommit(true)
.Columns(column =>
{

column.For(x => x.Id).HeaderText("Id").DataType("number");
column.For(x => x.ExternalId).HeaderText("ExternalId").DataType("text");
column.For(x => x.CAMName).HeaderText("Name").DataType("text");
column.For(x => x.YearlyCAMAmount).HeaderText("Amount/Yr").DataType("number");
column.For(x => x.MonthlyCAMAmount).HeaderText("Amount/Mo").DataType("number");
column.For(x => x.PerSqFtCAMAmount).HeaderText("Amount/SF").DataType("number");
column.For(x => x.StartingIncome).HeaderText("Starting Income").DataType("number");
column.For(x => x.IsCAMActive).HeaderText("Active?").DataType("bool");
column.For(x => x.CamStartDate).HeaderText("Start Date").DataType("date");
})
.Features(f =>
{
f.Paging().Type(OpType.Local).PageSize(20).TotalRecordsCount(Model.Count());


f.Responsive();

f.Updating()
.ColumnSettings(cs =>
{
cs.ColumnSetting().ColumnKey("Id").EditorType(ColumnEditorType.Numeric).Required(true).ReadOnly(true);
cs.ColumnSetting().ColumnKey("ExternalId").EditorType(ColumnEditorType.Numeric);
cs.ColumnSetting().ColumnKey("CAMName").EditorType(ColumnEditorType.Text).Required(true);
cs.ColumnSetting().ColumnKey("YearlyCAMAmount").EditorType(ColumnEditorType.Currency);
cs.ColumnSetting().ColumnKey("MonthlyCAMAmount").EditorType(ColumnEditorType.Currency);
cs.ColumnSetting().ColumnKey("PerSqFtCAMAmount").EditorType(ColumnEditorType.Currency);
cs.ColumnSetting().ColumnKey("StartingIncome").EditorType(ColumnEditorType.Currency);
cs.ColumnSetting().ColumnKey("IsCAMActive");
cs.ColumnSetting().ColumnKey("CamStartDate").EditorType(ColumnEditorType.DatePicker);
})
.EnableAddRow(true)
.EditMode(GridEditMode.Dialog)
.EnableDeleteRow(true)
.RowEditDialogOptions(opt =>
{
opt.Containment("owner");
opt.DialogTemplateSelector("#dialogTemplate");
opt.EditorsTemplateSelector("#editorsTemplate");
opt.ShowReadonlyEditors(false);
opt.Width("300px");
opt.Height("400px");
});
f.Hiding()
.ColumnSettings(cs =>
{
cs.ColumnSetting().ColumnKey("Id").Hidden(true).AllowHiding(false);
cs.ColumnSetting().ColumnKey("ExternalId").AllowHiding(false);
cs.ColumnSetting().ColumnKey("CAMName").AllowHiding(false);
cs.ColumnSetting().ColumnKey("YearlyCAMAmount").AllowHiding(false);
cs.ColumnSetting().ColumnKey("MonthlyCAMAmount").AllowHiding(false);
cs.ColumnSetting().ColumnKey("PerSqFtCAMAmount").AllowHiding(false);
cs.ColumnSetting().ColumnKey("StartingIncome").AllowHiding(false);
cs.ColumnSetting().ColumnKey("IsCAMActive").AllowHiding(false);
cs.ColumnSetting().ColumnKey("CamStartDate").AllowHiding(false);


});


})

.DataBind()
.Render())

Parents
No Data
Reply
  • 155
    Offline posted

    I removed hiding and added it in column settings of the whole grid when I declare the Keys and the model's columns: 

    I attached my code below:

    @(Html.Infragistics()
    .Grid(Model)
    .ID("CAMExpenseListGrid")
    .AutoGenerateColumns(false)
    .PrimaryKey("Id")
    .RenderCheckboxes(true)
    .AutoCommit(true)
    .Columns(column =>
    {

    column.For(x => x.Id).HeaderText("Id").DataType("number").Hidden(true);
    column.For(x => x.ExternalId).HeaderText("ExternalId").DataType("text").Hidden(true); //THIS IS WHERE I ADDED THE HIDDEN ATTRIBUTES
    column.For(x => x.CAMName).HeaderText("Name").DataType("text");
    column.For(x => x.YearlyCAMAmount).HeaderText("Amount/Yr").DataType("number");
    column.For(x => x.MonthlyCAMAmount).HeaderText("Amount/Mo").DataType("number");
    column.For(x => x.PerSqFtCAMAmount).HeaderText("Amount/SF").DataType("number");
    column.For(x => x.StartingIncome).HeaderText("Starting Income").DataType("number");
    column.For(x => x.IsCAMActive).HeaderText("Active?").DataType("bool");
    column.For(x => x.CamStartDate).HeaderText("Start Date").DataType("date");
    })
    .Features(f =>
    {
    f.Paging().Type(OpType.Local).PageSize(20).TotalRecordsCount(Model.Count());


    f.Responsive();

    f.Updating()
    .ColumnSettings(cs =>
    {
    cs.ColumnSetting().ColumnKey("Id").EditorType(ColumnEditorType.Numeric).Required(true).ReadOnly(true);
    cs.ColumnSetting().ColumnKey("ExternalId").EditorType(ColumnEditorType.Numeric);
    cs.ColumnSetting().ColumnKey("CAMName").EditorType(ColumnEditorType.Text).Required(true);
    cs.ColumnSetting().ColumnKey("YearlyCAMAmount").EditorType(ColumnEditorType.Currency);
    cs.ColumnSetting().ColumnKey("MonthlyCAMAmount").EditorType(ColumnEditorType.Currency);
    cs.ColumnSetting().ColumnKey("PerSqFtCAMAmount").EditorType(ColumnEditorType.Currency);
    cs.ColumnSetting().ColumnKey("StartingIncome").EditorType(ColumnEditorType.Currency);
    cs.ColumnSetting().ColumnKey("IsCAMActive");
    cs.ColumnSetting().ColumnKey("CamStartDate").EditorType(ColumnEditorType.DatePicker);
    })
    .EnableAddRow(true)
    .EditMode(GridEditMode.Dialog)
    .EnableDeleteRow(true)
    .RowEditDialogOptions(opt =>
    {
    opt.Containment("owner");
    opt.DialogTemplateSelector("#dialogTemplate");
    opt.EditorsTemplateSelector("#editorsTemplate");
    opt.ShowReadonlyEditors(false);
    opt.Width("300px");
    opt.Height("400px");
    });


    })

    .DataBind()
    .Render())

Children