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 GridColumn EditType=DropDownEdit ForeignKeyField Assistance Needed

Hi,

If setup a blazor grid with the following column:

<GridColumn Field="Month" HeaderText="Month" Width="15" EditType="dropdownedit" ForeignKeyField="value" ForeignKeyValue="text" DataSource="@months" ></GridColumn>

@months is a list of months.
@functions {
    public class Month
    {
        public string value { get; set; }
        public string text { get; set; }
    }
    List<Month> months = new List<Month>()
    {
        new Month(){ value = "1", text= "Jan" },
        new Month(){ value = "2", text= "Feb" },
        new Month(){ value = "3", text= "Mar" },
        new Month(){ value = "4", text= "Apr" },
        new Month(){ value = "5", text= "May" },
        new Month(){ value = "6", text= "Jun" },
        new Month(){ value = "7", text= "Jul" },
        new Month(){ value = "8", text= "Aug" },
        new Month(){ value = "9", text= "Sep" },
        new Month(){ value = "10", text= "Oct" },
        new Month(){ value = "11", text= "Nov" },
        new Month(){ value = "12", text= "Dec" }
    };
}


Issue:

The Grid displays data from the webapi however when in display mode the month column is blank. Data is being returned in the webapi call, a integer for the month number.

When in edit mode the month drop down shows no data, just the message "No Records Found"


Would someone be able to have a look at the Blazor page and see what the issue might be?

Orders.Razor
@page "/orders"
@using Newtonsoft.Json;
<div class="container-fluid">
    <div class="row pt-3">
        <div class="col-12">
            <EjsGrid ref="orderGrid" id="orderGrid" AllowSorting="true" AllowFiltering="true" AllowPaging="true" Height="100%" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
                <EjsDataManager ref="orderDataManager" CrossDomain="true" Url="http://localhost:5000/api/v2/order" Adaptor="Adaptors.WebApiAdaptor">
                </EjsDataManager>
                <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
                <GridFilterSettings Type="@Syncfusion.EJ2.RazorComponents.Grids.FilterType.CheckBox"></GridFilterSettings>
                <GridPagesettings pageCount="5" PageSize="15"></GridPagesettings>
                <GridColumns>
                    <GridColumn Field="OrderLineId" HeaderText="Order Line Id" ISPrimaryKey="true" IsIdentity="true" Visible="false" Width="30" validationRules="@(new { required= true, maxLength=6})"></GridColumn>
                    <GridColumn Field="StyleCode" HeaderText="Code" Width="20" validationRules="@(new { required= true, maxLength=20})"></GridColumn>
                    <GridColumn Field="ItemDescription" HeaderText="Name" Width="40" validationRules="@(new { required= true, maxLength=50})"></GridColumn>
                    <GridColumn Field="ClassCode" HeaderText="Class" Width="20" validationRules="@(new { required= true, maxLength=20})"></GridColumn>
                    <GridColumn Field="Month" HeaderText="Month" Width="15" EditType="dropdownedit" ForeignKeyField="value" ForeignKeyValue="text" DataSource="@months" ></GridColumn>
                </GridColumns>
            </EjsGrid>
        </div>
    </div>
</div>
@functions {
    public class Month
    {
        public string value { get; set; }
        public string text { get; set; }
    }
    List<Month> months = new List<Month>()
    {
        new Month(){ value = "1", text= "Jan" },
        new Month(){ value = "2", text= "Feb" },
        new Month(){ value = "3", text= "Mar" },
        new Month(){ value = "4", text= "Apr" },
        new Month(){ value = "5", text= "May" },
        new Month(){ value = "6", text= "Jun" },
        new Month(){ value = "7", text= "Jul" },
        new Month(){ value = "8", text= "Aug" },
        new Month(){ value = "9", text= "Sep" },
        new Month(){ value = "10", text= "Oct" },
        new Month(){ value = "11", text= "Nov" },
        new Month(){ value = "12", text= "Dec" }
    };
}




2 Replies

VN Vignesh Natarajan Syncfusion Team June 24, 2019 09:13 AM UTC

Hi Chris, 
 
Thanks for contacting Syncfusion forums.  
 
Query: “When in edit mode the month drop down shows no data, just the message "No Records Found" 
 
We have validated the “dataSource is not bounded to foreignkeycolumn” requirement and we are able to reproduce the reported issue at our end. This is because currently we do not have support for ForeignKey Column in ASP.NET Core Blazor. We have already considered this requirement as feature and it is implemented internally in our source. We will include this feature support in our upcoming 2019 Volume 2 Beta release which is expected to be rolled out in the month end of June 2019.  
 
Till then we appreciate your patience.  
 
Regards, 
Vignesh Natarajan 
 



CH Chris June 24, 2019 10:11 AM UTC

Thanks Vignesh I'll look out for the feature in the upcoming 2019 Volume 2 Beta release.

Loader.
Live Chat Icon For mobile
Up arrow icon