Search Function in SfGrid Is Not Working

Hi,


Data from a different table in the Grid Column template and printed with a span tag or p tag or div tag cannot be found when searching.


Does not find the data in the following example in the search


<GridColumn Field="SipAd" Context="SContext" HeaderText="Sip Adı" ClipMode="ClipMode.EllipsisWithTooltip" TextAlign="TextAlign.Left" Width="150">

                    <Template>

                        @{

                            var value = (SContext as PModel);

                            KModel ForeignKeyData = KModels?.Where(x => x.Id == value.KModelId).FirstOrDefault();

                            if (ForeignKeyData != null)

                            {

                                var SipId = ForeignKeyData?.SModelId.Value;

                                SModel foreignKeyData2 = SModels?.Where(y => y.Id == SipId).FirstOrDefault();

                                var SipName = foreignKeyData2?.S_Name;

                                <div>@SipName </div>

                            }

                        }

                    </Template>

</GridColumn>




I looked at the search documentation on your page on this topic, but couldn't find what I was looking for.


Thanks in advance.


1 Reply

MS Monisha Saravanan Syncfusion Team May 11, 2023 06:33 AM UTC

Hi Mustafa,


Greetings from Syncfusion support.


Query: “Search Function in SfGrid Is Not Working”


We would like to inform you that in DataGrid, data operations will be performed based on the field values i.e.) the data operations like sort, search and filter takes place only based on the field values. 


And template is used only for display purpose. From you shared code we suspect that you are trying to perform search based on the template column value. So it is not feasible to perform search based on the template column value.


Please let us know if you have any concerns.


Regards,

Monisha


Loader.
Up arrow icon