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

EjsGrid Display Data Problem

I have the following grid:
All columns show the data, except
 <EjsGrid id="Grid" DataSource="@vehicles" AllowPaging="true">
        <GridPageSettings PageSizes="true"></GridPageSettings>
        <GridColumns>
            <GridColumn Field="@nameof(VehicleIJ.VehicleShortName)" HeaderText="Name"></GridColumn>
            <GridColumn Field="@nameof(VehicleIJ.VehicleBrand.VehicleBrandID)" HeaderText="Brand"></GridColumn>
            <GridColumn Field="@nameof(VehicleIJ.VehicleModel.ModelName)" HeaderText="Model"></GridColumn>
        </GridColumns>
    </EjsGrid>
Both fields are strings, If I use another field which is an int: VehicleIJ.VehicleBrand.VehicleBrandID it shows the data.
Note that the fields that are not working are the ones inside another field.

1 Reply

VN Vignesh Natarajan Syncfusion Team July 26, 2019 05:56 AM UTC

Hi Raul,  

Greetings from Syncfusion support.  

Query: “EjsGrid Data display problem” 

We have analyzed the provided code example and prepared a sample using your code example. We are able to reproduce the reported issue at our end too. This is because Grid cannot know what may be inherited and its values related to its base type it is bound to. So we suggest you to resolve the issue by defining the complex property directly in the column definition as below  

Refer the below code example  

<EjsGrid @ref="@grid" AllowPaging="true" DataSource="@data" OnBatchSave="onsave" Toolbar="@(new List<string> {"Add","Edit","Delete","Update","Cancel" })"> 
    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Orders.OrderID) HeaderText="Order ID" Type="number" ISPrimaryKey="true" Width="90"></GridColumn> 
        <GridColumn Field=@nameof(Orders.CustomerID) HeaderText="Customer ID" Type="string" Width="90"></GridColumn> 
        <GridColumn Field=@nameof(Orders.EmployeeID) HeaderText="Employee ID" Type="string" Width="90"></GridColumn> 
        <GridColumn Field=@nameof(Orders.Freight) HeaderText="Freight" Type="number" Width="90"></GridColumn> 
        <GridColumn Field="Employee.Address" HeaderText="Address" Type="string" Width="90"></GridColumn> 
        <GridColumn Field="Employee.ID" HeaderText="ID" Type="number" Width="90"></GridColumn> 
    </GridColumns> 
</EjsGrid> 

Refer the below screenshot for the output 

 

For your convenience we have prepared a sample which can be downloaded from below link  


Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


Loader.
Up arrow icon