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

Grid ForeignKeyValue Issue

Dear Sir,

Version="17.3.0.26-beta" 
Blazor Core Hosted.

   <EjsGrid TValue="UnitOfMeasureDto" AllowFiltering="true" AllowReordering="true" AllowResizing="true" @ref="UnitOfMeasureGrid" DataSource="@unitofmeasures" ModelType="@unitofmeasure" AllowPaging="true" Toolbar="@(new List<string>() {"Search"})" Width="100%" AllowExcelExport="true" AllowPdfExport="true" Height="auto">
                <GridEditSettings AllowDeleting="true" ShowDeleteConfirmDialog="true"></GridEditSettings>
                <GridPageSettings PageSizes="true"></GridPageSettings>
                <GridFilterSettings Type="Syncfusion.EJ2.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
                <GridEvents TValue="UnitOfMeasureDto" OnActionComplete="OnComplete" RowSelected="onRowSelected" OnRecordDoubleClick="onDoubleClick" />
                <GridColumns>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.Id) Visible="false" IsPrimaryKey="true"></GridColumn>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.GSTCode) HeaderText="GST Code" Width="160"></GridColumn>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.GSTName) Width="200" HeaderText="GST Name"></GridColumn>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.MeasurementId) Width="200" HeaderText="Measurement Type" ForeignKeyValue="Value"  DataSource="@metaInfoMesurements"></GridColumn>

                    <GridColumn HeaderText="Manage" Width="150">
                        <GridCommandColumns>

                            <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat" })"></GridCommandColumn>
                            @*<GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = @Enum.GetName(typeof(MeasurementType), 5), CssClass = "e-flat" })"></GridCommandColumn>*@
                        </GridCommandColumns>
                    </GridColumn>
                </GridColumns>
            </EjsGrid>


@code

{
public List<MetaInfoMesurement> metaInfoMesurements { get; set; }

    public UnitOfMeasureDto UnitOfMeasureEditModel { get; set; } = new UnitOfMeasureDto();


 protected override async Task  OnInitializedAsync()
    {
         ApiResponseDto apiResponseMetadatas = await  Http.GetJsonAsync<ApiResponseDto>("api/MetaData/Mesurement");
          metaInfoMesurements = Newtonsoft.Json.JsonConvert.DeserializeObject<MetaInfoMesurement[]>apiResponseMetadatas.Result.ToString()).ToList<MetaInfoMesurement>();
        ApiResponseDto apiResponse = await Http.GetJsonAsync<ApiResponseDto>("api/UnitOfMeasure");

        if (apiResponse.StatusCode == 200)
        {
           
            unitofmeasures = Newtonsoft.Json.JsonConvert.DeserializeObject<UnitOfMeasureDto[]>(apiResponse.Result.ToString()).ToList<UnitOfMeasureDto>();


            matToaster.Add(apiResponse.Message, MatToastType.Success, "UOM List Retrieved");//metaInfoGender=MetaDataDtos.
        }
        else
        {
            matToaster.Add(apiResponse.Message + " : " + apiResponse.StatusCode, MatToastType.Danger, "UOM List Retrieval Failed");
        }
    }
}

When i try to give ForeignKeyValue  in Grid Column grid could not populate. please find attached screen shot

Regards
Vijay




Attachment: FKeyError_6d80d0a8.zip

5 Replies

VN Vignesh Natarajan Syncfusion Team November 11, 2019 09:01 AM UTC

Hi VijayMohan,  

Greetings from Syncfusion support.  

Query: “When i try to give ForeignKeyValue  in Grid Column grid could not populate. please find attached screen shot 
 
We have analyzed the provided screenshot and from that we have found that ForeignKeyColumn’s Field value (MeasurementId) does not match with the any of the columns from ForeignKey dataSource  (MetaInfoMesurements). We have checked the foreignkey column data returned from a service, it contains column like value, isActive and mesurementId.  But in column definition, you have defined the Field value as MeasurementId. Both values are not same. Hence the reported issue occurred.  

Refer the below highlighted code for error 

   <GridColumn Field=@nameof(UnitOfMeasureDto.MeasurementId) Width="200" HeaderText="Measurement Type" ForeignKeyValue="Value"  DataSource="@metaInfoMesurements"></GridColumn> 
   
But in the column dataSource(metainfoMesurements), field value is different (mesurementId). So kindly define the Field value properly to resolve the issue.  

Refer our UG documentation for your reference 


Please get back to us if you have further queries.    

Regards,
Vignesh Natarajan. 



VI vijaymohan November 11, 2019 09:38 AM UTC

Dear Sir,

Thank You.  Issue resolved. But when i try grid filter apply column text only disappear. rows not updated. rest of column filter working properly. please find the screen shot.



  <EjsGrid TValue="UnitOfMeasureDto" AllowFiltering="true" AllowReordering="true" AllowResizing="true" @ref="UnitOfMeasureGrid" DataSource="@unitofmeasures" ModelType="@unitofmeasure" AllowPaging="true" Toolbar="@(new List<string>() {"Search"})" Width="100%" AllowExcelExport="true" AllowPdfExport="true" Height="auto">
                <GridEditSettings AllowDeleting="true" ShowDeleteConfirmDialog="true" Mode="EditMode.Dialog"></GridEditSettings>
                <GridPageSettings PageSizes="true"></GridPageSettings>
                <GridFilterSettings Type="Syncfusion.EJ2.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
                <GridEvents TValue="UnitOfMeasureDto" OnActionComplete="OnComplete"  OnRecordDoubleClick="onDoubleClick" />
                <GridColumns>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.UnitOfMeasureId) Visible="false" IsPrimaryKey="true"></GridColumn>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.GSTCode) HeaderText="GST Code" Width="160"></GridColumn>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.GSTName) Width="200" HeaderText="GST Name"></GridColumn>
                    <GridColumn Field=@nameof(UnitOfMeasureDto.MeasurementId) Width="200" HeaderText="Measurement Type" ForeignKeyValue="Value"  ForeignKeyField="MesurementId"  DataSource="@metaInfoMesurements"></GridColumn>

                    <GridColumn HeaderText="Manage" Width="150">
                        <GridCommandColumns>

                            <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat" })"></GridCommandColumn>
                            @*<GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = @Enum.GetName(typeof(MeasurementType), 5), CssClass = "e-flat" })"></GridCommandColumn>*@
                        </GridCommandColumns>
                    </GridColumn>
                </GridColumns>
            </EjsGrid>


VI vijaymohan November 12, 2019 07:43 AM UTC

Dear Sir,

Any Update regarding this issue. awaiting for your reply.

Regards
vijay




VN Vignesh Natarajan Syncfusion Team November 12, 2019 01:40 PM UTC

Hi VijayMohan,  
 
Query: “But when i try grid filter apply column text only disappear. rows not updated. 
 
We are able to reproduce the reported issue “Not able to filter the foreignkey column properly” at our end while preparing the sample as your Grid (screenshot). Currently we are validating your issue, so we will update you the further details on 14th November 2019. 
 
Till then we appreciate your patience.   
  
Regards, 
Vignesh Natarajan. 



VN Vignesh Natarajan Syncfusion Team November 14, 2019 01:23 PM UTC

Hi VijayMohan,  

Thank you for taking the time to report this issue “Issue while filtering the foreignkey column using menu filter” and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our next Bi-Weekly Nuget release which is expected to be rolled out on or before 29th November 2019.  
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this feedback. 
 
 
Till then we appreciate your patience. 

Regards, 
Vignesh Natarajan.

Loader.
Live Chat Icon For mobile
Up arrow icon