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
375
Severals values in one cell of an igGrid possible?
posted

Hello everybody!

 

I wonder if it is possible to add several values (a list for example) in one cell of an igGrid?

In fact, for a single ID of a person, there are several addresses.

I would like keep ID of address added to the entity of the person and at the same time, I would like display all these addresses in on cell.

Best regards,

F2O

  • 23953
    Verified Answer
    Offline posted

    Hello F2O,

    This can be achieved, but your model have to have all the addresses data (for example you may have a Address field of type List<Address>). 

    When configuring your igGrid you can use templating to create a list of the person addresses.

    Here is an example:

    var persons = [
    {PersonID: "1", Addresses: [
    {Address: "Address1"},
    {Address: "Address2"},
    {Address: "Address3"}
    ]}
    ];

    $("#grid1").igGrid({
    width: "700px",
    primaryKey: "PersonID",
    columns: [
    { headerText: "Person ID", key: "PersonID", dataType: "number"},
    { headerText: "Addresses", key: "Addresses", dataType: "object", template: "<ul>{{each ${Addresses} }} <li>${Addresses.Address}</li> {{/each}}</ul>"}
    ],
    autoGenerateColumns: false,
    dataSource: persons
    });

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc.