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

DataGrid Toolbar Print with no data

Hi Support ,


I use the SfDataGrid Toolbar for Print Grid Data, but preview display with no data.


Best Regards!

Jacky




7 Replies 1 reply marked as answer

NP Naveen Palanivel Syncfusion Team March 27, 2023 06:34 PM UTC

Hi Jacky,


We checked your query, we prepared sample in toolbar for Print the Grid Data. But report issue does not occurs at our end. Please refer the attached sample for your reference.


If the reported issue still reproduced then kindly share the below details to validate further at our end.


  1. Share us the entire Grid code snippet along with model class
  2. Share us the video demonstration of the issue in provided sample.
  3. If possible share us an simple issue reproduceable sample or try to modify the above mentioned sample.


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible


Regards,

Naveen Palanivel


Attachment: Blazor_27_3_(2)_42b4844e.zip


JA Jacky March 29, 2023 06:07 AM UTC

Hi  Naveen,


I add my code to your attached sample as follow zip file.


Please kindly help!

Jacky



Attachment: Blazor_27_3_5a0d9c7c.zip


NP Naveen Palanivel Syncfusion Team April 4, 2023 04:29 PM UTC

Hi Jacky,


We reviewed your query and validated the provided sample; however, print does not work due to the async Task. Delay (100) in custom adaptor. To solve the problem, we recommend using Yield() in a custom adaptor. Please see the attached sample and code snippet for reference.


public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)

    {   

        //讀取資料

        List<OrderData> adaptorModelObjects = OrderData.GetAllRecords();

        await Task.Delay(100);

        await Task.Yield();

 

        int count = adaptorModelObjects.Count();

        return dataManagerRequest.RequiresCounts ? new DataResult() { Result = adaptorModelObjects, Count = count } : (object)adaptorModelObjects;

 

    }



Please let us know if you have any concerns.


Regards,

Naveen Palanivel


Attachment: Blazor_27_3_print_3e8e24f5.zip

Marked as answer

JA Jacky April 5, 2023 02:39 AM UTC

Hi Naveen,


Sorry update reply, I test my several projects, It's somtimes worked, somtimes still print empty.

I don't know why? 


Regards!

Jacky



NP Naveen Palanivel Syncfusion Team April 5, 2023 08:06 PM UTC

Hi Jacky,


We investigated your query, however the reported issue of print not working sometimes does not occur at our end. For more details, please see the video demonstration attached.


Please let us know if you have any concerns.


Regards,

Naveen Palanivel


Attachment: screencapture_(3)_Print_cd98e323.zip


JA Jacky April 6, 2023 02:00 AM UTC

Hi  Naveen,


Thank for your quickly reply.

I finally found out when use the  custom adaptor with async must modify as follows, seems to can not use any async ,  Is there a better solution?


Best Regards!

Jacky