1

Hi have a json object which is of type

{
  "alpha": [
    {
      "t1": {},
      "t2": {},
      "t3": [
        {
          "type": "a",
          "width": "b"
        }
      ]
    }
  ]
}

In my dev extreme I have given the following code:

<dx-data-grid id="gridContainer"
    [dataSource]="alpha"
    [masterDetail]="{ enabled: true, template: 'detail' }"
    keyExpr="ID"
    [showBorders]="true">

    <dxi-column dataField="t1" caption="Type1"></dxi-column>
    <dxi-column dataField="t2" caption="Type2"></dxi-column>

    <div *dxTemplate="let al of 'detail'">
        <dx-data-grid 
------------------------------
            [dataSource]="alpha.t3"
            [showBorders]="true"
            [columnAutoWidth]="true">
                <dxi-column dataField="type"></dxi-column>
                <dxi-column dataField="width" dataType="date"></dxi-column>

------------------------
[dataSource]="alpha"
            [showBorders]="true"
            [columnAutoWidth]="true">
                <dxi-column dataField="t3.type"></dxi-column>
                <dxi-column dataField="t3.width" dataType="date"></dxi-column>

------------------------
        </dx-data-grid>       
    </div>
</dx-data-grid>

Here from the alpha object, I am displaying t1 and t2 as table rows while t3 is shown only when the row is expanded. Once the row expands, it will show type = a and width = b. I have tried two ways to solve the situation separated by --------------- but both are not working. I am able to display the t1 and t2 in the outside rows but t3 table only shows type and width, the values are coming as empty.

1 Answers1

0

I think the first solution is very close , you did a loop of template but you've never used.

Try this one:

[dataSource]="al"
            [showBorders]="true"
            [columnAutoWidth]="true">
                <dxi-column dataField="type"></dxi-column>
                <dxi-column dataField="width" dataType="date"></dxi-column>

What's more, i think there's maybe a problem with the original dataSource cause it's sometime an array, sometimes an object, maybe it's better to be changed as one choice between these two.