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
195
MVC Hierarchical grid
posted

Hello,

I'm testing the MVC Hierarchical grid with the following code. I can't edit the child rows and I can't select one child row, it selects all the child row.

@(Html.Infragistics()
.Grid(Model)
.ID("igGrid")
.AutoGenerateColumns(false)
.PrimaryKey("ID")
.Features(f =>
{
f.Updating().EditMode(GridEditMode.Row);
})
.UpdateUrl(Url.Action("CfgCatalogsSaveData"))
.Columns(column =>
{
column.For(x => x.ID).HeaderText("ID");
column.For(x => x.Name).HeaderText("Name");
})
.ColumnLayouts(layouts => {

layouts.For(x => x.CfgCatalogItems)
.PrimaryKey("ID")
.AutoGenerateColumns(false)
.AutoCommit(true)
.Columns(childcols1 =>
{
childcols1.For(x => x.ChoiceValue).HeaderText("Valeur");
childcols1.For(x => x.Label).HeaderText("Texte");
childcols1.For(x => x.Congruent).HeaderText("Compliant");
})
.Features(g =>
{
g.Updating().EditMode(GridEditMode.Row);
})
;
})

.DataBind()
.Render())

Best regards,

Alain

Parents
  • 5513
    Offline posted

    Hello Alain,

    Both issues are most likely related to the fact you are not defining the ID column for the child layout but still set it as a primary key. Updating requires that there is a correct and unique primary key defined available for the data source you are editing. Selection would select all rows that have the same PK and since the PK column is not defined all values for it will be 'null' causing the behavior you are experiencing.

    I hope this helps! Please, let me know if you have any other questions or concerns!

    Best regards,

    Stamen Stoychev

Reply Children