Closed leonardopugliese closed 7 months ago
Presently, we recognize that generating exports like XLSX is primarily a server-side task, and as such, we haven't included built-in support for it in HxGrid
. We understand you might wish to develop a custom component in your Blazor Server project to add this export functionality. If you can provide us with a list of extensibility points (such as methods that need to be changed from private
to protected
), we will consider making these adjustments.
At the moment what I essentially need, to generate a basic file, is to dynamically recover the displayed columns and in particular the HeaderText field (the one that the GetColumnsToRender() method in HxGrid.razor.cs does which is currently private). After that I would need the rows of the table currently displayed, i.e. after the sorting and possible filter have been applied
@leonardopugliese We can set those methods to protected
, but that's just the start. The real issue lies with DataProvider
. You need to supply it with a request that's already set up with the current sorting, but with request.StartIndex = 0
and request.Count = null
, in order to retrieve all items. I'm assuming you're aiming to export the entire dataset, not just the currently displayed page or segment. Our current code structure doesn't include methods that, even after being set to protected
, would meet this requirement.
@hakenr I understand. However having the list of columns is a start. It would be fantastic to be able to know which column the sorting was done on, in this way I would probably have solved my problem
@hakenr I was able to successfully export the information I needed to excel/pdf simply by using the GetColumnsToRender() method. Thank you very much!
I would like to insert a generic method for exporting to xls from HxGrid. The idea would be to retrieve the columns from HxGrid to have the HeaderText and the rows from the DataProvider. Is there a way to retrieve this information? I saw that the GetColumnsToRender() method for example is private.
Thank you