Set order for Export to Excel/PDF
Set order for Export to Excel/PDF
My data is returned in the correct order for export, but when displayed, it does reverse it currently (via order: [[x, desc]], and users can reorder it in the display via the column headers. I'd like the export options to be able to use the initial data order, and have the display sorting not change that.
I've searched and not found anything that seems it might work. I've tried several options including specifying Export options, toyed with a Sort setting in the customize options, although the sort field is a visible: false and I'm not exporting non visible fields, I read up on orthagonal, and I've not yet grok'd that, and being a javascript and jquery noobie having some trouble knowing where to go from here.
I considered having two different objects with the same data, but I'm not sure whether that is even possible, nor how to even clone an object rather than establish another reference to the original.
This question has an accepted answers - jump to answer
Answers
Use the
selector-modifier
'sorder
option, set to beindex
.The selector modifier can be set through the
exportOptions
option parameter of theexcelHtml5
andpdfHtml5
button types.Allan
Thanks Allan,
After the hint, and some digging through the buttons code, I found I needed to wrap that in a modifier "tag" before it would work.
It did help me understand a little better about what is going on, although I do still get lost very quickly.