Sort on Foreign Column

In a grid with a <GridForeignColumn>, the sort is apparently on the Field of the DataSource and should be on the ForeignkeyValue field, which is implied by using the <GridForeignColumn>.

This is an example of a Grid that displays Care Facilities. It uses a Facility Type lookup table to display the type of facility. The Facility Type table is dynamic as the end-user may add or delete existing facility types. Therefore, exists on its own. - a common pattern.

                        <GridColumns>
                            <GridColumn Field=@nameof(CareFacilityDto.CareFacilityId) IsPrimaryKey="true" Visible="false" />
                            <GridColumn Field=@nameof(CareFacilityDto.Name) Type="ColumnType.String" HeaderText="Name" Width="70"></GridColumn>
                            <GridForeignColumn Field=@nameof(CareFacilityDto.FacilityTypeId) ForeignDataSource=@FacilityTypes ForeignKeyField="Id" ForeignKeyValue="Name" HeaderText="Facility Type" Width="50"></GridForeignColumn>
                            <GridColumn Field=@nameof(CareFacilityDto.Street) Type="ColumnType.String" EditType="EditType.DefaultEdit" HeaderText="Street" Width="50"></GridColumn>
                            <GridColumn Field=@nameof(CareFacilityDto.City) Type="ColumnType.String" EditType="EditType.DefaultEdit" HeaderText="City" Width="25"></GridColumn>
                            <GridColumn Field=@nameof(CareFacilityDto.State) Type="ColumnType.String" EditType="EditType.DefaultEdit" HeaderText="State" Width="25"></GridColumn>
                            <GridColumn Field=@nameof(CareFacilityDto.ZipCode) Type="ColumnType.Number" EditType="EditType.NumericEdit" HeaderText="Zip Code" Width="25"></GridColumn>
                            <GridColumn Field=@nameof(CareFacilityDto.ContactPhone) Type="ColumnType.String" Format="d" HeaderText="Phone" Width="25"></GridColumn>
                        </GridColumns>

There is a single foreign key column that references a facility type lookup table, a very common practice, It uses the FacilityTypeId field from the grids DataSource to index (reference) the value that should be displayed. It is this value that should be sorted and not the key used to do the lookup of the value.

This is critical functionality and should be corrected as soon as possible.

Thanks

Mike

1 Reply

VN Vignesh Natarajan Syncfusion Team November 2, 2020 07:42 AM UTC

Hi Mike,  
 
Thanks for contacting Syncfusion support.   
       
We have checked the reported problem at our end and we are able to reproduce the reported behavior at our end also. Sort action takes place based on ForeignKeyField value instead of ForeignKeyValue (i.e.) lookup table value. Since it is a known issue, we have confirmed it is a bug and logged the defect report “Sorting operation does not work properly for foreign key column”. Thank you for taking the time to report this issue 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 upcoming  2020 Volume 3 Service Pack release which is expected to be rolled out by mid of this month, (November 2020).      
       
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.      
      
 
Note: Kindly login into your account to view the feedback.      
 
Until then we appreciate your patience.      
   
Regards,   
Vignesh Natarajan 
 


Loader.
Up arrow icon