May 09, 2015, 10:08 PM
[CLOSED] Grids HasManyAssociation() get only one item in the second grid
I am basing this on the Has Many example from your MVC solution and cannot figure out why I only get on item in the linked list, the last one.
I can confirm in debugger that the model list (HeaderDataModelList) is returning multiple items for Splits.
But clicking on the row in the top grid only gives me the last item of the relating splits.
Can you see anything wrong in this code that can cause this.
Thank you
X.Model()
.Name("SDataModelList")
.IDProperty("UNIQUE_REF")
.Fields(
X.ModelField()
.Name("TRAN_NUMBER")
.Type(ModelFieldType.Int),
X.ModelField()
.Name("TypeText")
.Type(ModelFieldType.String)
)
X.GridPanel().EnableColumnHide(false)
.ColumnModel(X.Column().Text("No").DataIndex("Number").Width(50).Align(Alignment.Right),
X.Column().Text("Type").DataIndex("TypeText").Width(40),
X.DateColumn().Text("Date").DataIndex("DATE").Width(90),
X.Column().Text("Ref").DataIndex("INV_REF").Width(60),
X.Column().Text("Details").DataIndex("DetailsFull").Flex(1)
)
.SelectionModel(Html.X().RowSelectionModel().Mode(SelectionMode.Single))
.Height(220)
.Scroll(ScrollMode.Vertical)
.Store(
X.Store()
.ID("ActStore")
.AutoLoad(true)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetLink", "List", new { area = "Record" }))
.Reader(Html.X().JsonReader().Root("data"))
)
.Listeners(l => l.Exception.Handler = "")
.Parameters(parameter =>
{
parameter.Add(Html.X().StoreParameter().Name("id").Mode(ParameterMode.Value).Value("Ext.getCmp('CustAcctivityAccRef').getValue()"));
})
.Model(
X.Model()
.Name("HeaderDataModelList")
.IDProperty("Number")
.Fields(
X.ModelField()
.Name("Number")
.Type(ModelFieldType.Int),
X.ModelField()
.Name("TypeText")
.Type(ModelFieldType.String),
X.ModelField()
.Name("DATE")
.Type(ModelFieldType.Date)
)
.Associations(a => a.Add(X.HasManyAssociation()
.Model("SDataModelList")
.Name("Splits")
.AssociationKey("Splits")
))
)
)
.Listeners(l => l.SelectionChange.Handler = "selected.length && #{SplitsGrid}.bindStore(selected[0].Splits());"),
X.Panel().Height(10).Border(false).BodyStyle("background-color:transparent;"),
X.GridPanel().EnableColumnHide(false)
.ID("SplitsGrid")
.Scroll(ScrollMode.Both)
.Height(220)
.Store(
X.Store().ID("SplitsGridCustomerStore")
.ModelName("SDataModelList")
)
.ColumnModel(
X.Column().Text("No").DataIndex("TRAN_NUMBER").Width(50).Align(Alignment.Right),
X.Column().Text("Type").DataIndex("TypeText").Width(40)
)
models are shorter here for brevity. I can confirm in debugger that the model list (HeaderDataModelList) is returning multiple items for Splits.
But clicking on the row in the top grid only gives me the last item of the relating splits.
Can you see anything wrong in this code that can cause this.
Thank you
Last edited by Daniil; May 19, 2015 at 10:32 PM.
Reason: [CLOSED]