Hi Support ,
I use the SfDataGrid Toolbar for Print Grid Data, but preview display with no data.
Best Regards!
Jacky
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.
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
Hi Naveen,
I add my code to your attached sample as follow zip file.
Please kindly help!
Jacky
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
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
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
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
Hi Jacky,
We checked your query, we would like to inform that In your
example, it seems like you tried to call a synchronous method in an
asynchronous way, so using Task and Yield. If you're not familiar with these
concepts, you can also try using the Read method. Please refer the below
documentation
Custom
Binding in Blazor DataGrid Component | Syncfusion
Please let us know if you have any concerns.
Regards,
Naveen Palanivel