0

I am using a dojo dgrid tied to JSON store. This is what a row from a store looks like: Sample row

Store retrieves data from a table which contains fields (id, naziv, nivo, sifra). This table has a foreign key to a table JEZICI which contains fields (id, naziv, sifra, testDatumOd, testDatumDo).

When I show fields from original table everything works. But does anybody know if it is possible to reference fields from subtable JEZICI as columns in grid side by side with columns from original table?

Something like this probably:

columns: [
    { field: "id", label: "ID" },
    { field: "sifra", label: "Sifra" },
    { field: "naziv", label: "Naziv" },
    { field: "jezici.id", label "Jezici ID"}
],

Thanks!

phil
  • 707
  • 5
  • 19

1 Answers1

2

Yes, all you have to do is to define a formatter:

columns: [
    {
        id: "jezici-id",
        label: "Jezici ID",
        formatter: function(/*Object*/ row) {
            return row.jezici.id;
        }
    }
]
phusick
  • 7,342
  • 1
  • 21
  • 26