Is a render function required to return orthogonal data to Buttons?

Is a render function required to return orthogonal data to Buttons?

ChrisMiamiChrisMiami Posts: 7Questions: 3Answers: 0

Following the workaround presented in this discussion, I have set the buttons property of my table declaration as follows:

        buttons:        [ { extend:'excel', exportOptions: {orthogonal: {display:':null'}}},
                          { extend:'copy',  exportOptions: {orthogonal: {display:':null'}}},
                          { extend:'pdf',  exportOptions: {orthogonal: {display:':null'}}}
                        ]  ,

However, I'm still getting rendered data and not raw data, even for columns for which there's a render function returning raw data for sorting.

Do I need to add code in the render(data,type) function to test type for that ':null' string?

Thanks,
Chris

Answers

  • ChrisMiamiChrisMiami Posts: 7Questions: 3Answers: 0

    C'mon Community, just a yes or no answer's all I need. I know someone's gotta have this working somewhere! :)

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    Actually, looking back at my comment in the thread you linked to, I don't think that will work at all. As the documentation for buttons.exportData() notes, the orthogonal option takes a string value. It does not take an object.

    You could set orthogonal to be null, and assuming that your rendering function will return the original data if a type of null is passed in, then it should work. Alternatively set it to be export or similar and update your rendering function to return the required data when the export type is requested.

    Regards,
    Allan

  • ChrisMiamiChrisMiami Posts: 7Questions: 3Answers: 0

    Well. The short answer is YES.

    I will post next week the kind of documentation I wish I'd been able to find, but for now, the basic answer is that whatever you assign to the orthogonal property of the exportOptions object will be passed as-is to the render(data,type) function as the type argument. So, if you're testing for strings already, it's best NOT to create an anonymous object with a display property, but just set orthogonal: 'export' -- or whatever String you want to check for in your render().

    As I said, I'll post more detail next week.

    Thanks for nothing, ya hockey pucks! ;-) (RIP Don Rickles)
    Chris

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    Yup - that is in the docs, but it isn't obvious! I need to find a better way to make them flow more conceptually - particularly the exportOptions.

    Allan

This discussion has been closed.