Grid not searching

Hi I hope you can help.

I am running Syncfusion.Blazor (18.1.0.42)

My graph functions perfectly including searching until I use ForeignKeyField and ForeignKeyValues. After inserting the ForeignKeyFields search fails to work (I do not wish to search that field). I use a CustomDataAdaptor and the request to search is not passed onto the Adaptor.

Thank you in advance for any advice you may be able to give me.

Michael Wilson




            <GridColumn Field=@nameof(Models.Participant.Role) HeaderText="Role" Width="100" EditType="EditType.DropDownEdit" DataSource="@lstRoles" 
                AllowSearching="false" ForeignKeyField="Role" ForeignKeyValue="Role" />




        public List<ModelRoles> lstRoles { get; set; }
        int y = 0;
        lstRoles = new List<ModelRoles>();
        lstRoles.Add(new ModelRoles() { ID = y++.ToString(), Role = "Presenter" });
        lstRoles.Add(new ModelRoles() { ID = y++.ToString(), Role = "Student" });


    public class ModelRoles
    {
        public string ID { get; set; }
        public string Role { get; set; }
    }

3 Replies

VN Vignesh Natarajan Syncfusion Team April 30, 2020 07:05 AM UTC

Hi Michael,  
 
Thanks for contacting Syncfusion support.  
 
Query: “(I do not wish to search that field). I use a CustomDataAdaptor and the request to search is not passed onto the Adaptor. 
 
From your query we understand that you are facing issue while performing search operation with foreignkey column and custom adaptor. We suggest you to overcome the reported issue by using the below code highlighted code example. We have defined the GridFilterSettings to overcome the reported issue.  
 
Refer the below code example 
 
@{ 
    var Tool = (new List<string>() { "Search" }); 
    var Cols = new List<GridFilterColumn>();    
} 
  
    <SfGrid TValue="Order" AllowSorting="true" Toolbar=@Tool AllowFiltering="true" AllowPaging="true"> 
        <SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>       
        <GridFilterSettings Columns="Cols"></GridFilterSettings> 
        <GridPageSettings PageSize="8"></GridPageSettings> 
        <GridColumns> 
            <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Center" Width="140"></GridColumn> 
            <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> 
            <GridColumn Field=@nameof(Order.EmployeeID) HeaderText="Employee Name" AllowSearching="false" ForeignKeyValue="FirstName" DataSource="@Employees" Width="150"></GridColumn> 
            <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Width="150"></GridColumn> 
        </GridColumns> 
    </SfGrid> 
  
 
We have prepared a sample which can be downloaded from below  
 
 
Kindly get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan 



MW Michael Wilson April 30, 2020 10:21 PM UTC

Thank you, Vignesh

I appreciate your prompt and helpful reply. I don't understand why but your suggestions are working perfectly for me.

Thank you again and have a good day.


VN Vignesh Natarajan Syncfusion Team May 1, 2020 02:49 AM UTC

Hi Michael,  

Thanks for the update. 

We are glad to hear that you have resolved your query using our solution.  

Kindly get back to us if you have further queries.   

Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon