[CLOSED] Grids HasManyAssociation() get only one item in the second grid

  1. #1

    [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.

    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]
  2. #2
    Hi @registrator,

    Unfortunately, it is difficult to say what is wrong here. Please provide a runnable test case.

Similar Threads

  1. Replies: 2
    Last Post: Feb 24, 2014, 4:03 AM
  2. Replies: 6
    Last Post: Oct 15, 2012, 6:20 AM
  3. Replies: 0
    Last Post: Oct 03, 2012, 5:44 PM
  4. Replies: 1
    Last Post: Oct 01, 2012, 5:29 PM
  5. [CLOSED] V2.0 question on Model Associations and HasManyAssociation
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Apr 05, 2012, 3:42 PM

Posting Permissions