We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Access array value in grid

    <ej-grid #grid id="Grid"
    [dataSource]="data">
        <e-columns>
        <e-column field="recommendations[0].prop1" headerText="prop1"></e-column>   
        <e-column field="recommendations[0].prop2" headerText="prop2"></e-column>          
        </e-columns>
    </ej-grid>



Not sure how to implement something like this, structures is like this

data= [
     { 
          recommendations: [
            {
               prop1: 'hello',
               prop2: 'goodbye'
            }
          ]
     }
]

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team April 19, 2017 05:00 PM UTC

Hi Zack, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want give dataSource for the ejGrid control. 

Refer the below code example. 

[app.cpmponent.html] 

<ej-grid id="Grid" #grid  [dataSource]="data" [allowPaging]="true"> 
    <e-columns> 
        <e-column field="EmployeeID"  headerText="Employee ID"  ></e-column> 
        <e-column field="OrderID" headerText= "Order ID" ></e-column> 
    </e-columns> 
</ej-grid> 
 
---------------------------------------- 
[app.component.ts] 

export class AppComponent { 
 
 
    public data = [ 
 
        { OrderID: "10248", EmployeeID: 1 }, 
        { OrderID: "10249", EmployeeID: 2 }, 
        { OrderID: "10250", EmployeeID: 3 }         
    ] 
} 




Refer the help documentation. 



Regards, 
Thavasianand S. 


Loader.
Up arrow icon