EmptyRecordTemplate for "loading data" AND "no data" after search

In my app i have a custom loading gif inside an EmptyRecordTemplate, and it's working perfect.

But when i search the grid and the result is empty, i want to display a message saying: "no records to display" instead of the custom loading spinner.


4 Replies

SP Sarveswaran Palani Syncfusion Team September 22, 2022 05:16 PM UTC

Hi Pieterjan,

We are currently Validating the reported query at our end, and we will update the further details within two business days. Until then we appreciate your patience.

Regards,

Sarveswaran PK



SP Sarveswaran Palani Syncfusion Team September 26, 2022 06:30 PM UTC

Hi Pieterjan,


Sorry for the delay and inconvenience caused.


We have analyzed your query and suspect that you want to display “No records to display” when searching the empty grid. We suggest you to achieve your requirement by using a if condition inside the EmptyRecordTemplate feature of grid to differentiate text in empty Grid.


Kindly refer the attached code snippet for your reference.


<SfGrid @ref="grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() {"Update", "Search" })" Height ="315">

    <GridEvents OnDataBound="DataBoundHandler" OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents>

    <GridTemplates>

        <EmptyRecordTemplate>

            @if (grid.SearchSettings.Key != "")

            {

                <span>Custom record message</span>

                //Customize content to display

            }

            else

            {

              <span>No records to display</span> 

            }

 

        </EmptyRecordTemplate>

       

    </GridTemplates>


Kindly get back to us if you have any further queries.


Regards,

Sarveswaran PK



PV Pieterjan van der Leur September 27, 2022 07:22 AM UTC

Thank you for the support! 


The check with "SearchSettings.Key" worked  perfectely.


Kind regards



SP Sarveswaran Palani Syncfusion Team September 28, 2022 06:01 PM UTC

Hi Pieterjan,


Thanks for the update.


We're happy to hear that your issue has been resolved.


Kindly get back to us if you have any further queries.


Regards,

Sarveswaran PK



Loader.
Up arrow icon