Dynamic column names in "colvis buttons"

Dynamic column names in "colvis buttons"

skikeskike Posts: 5Questions: 3Answers: 0

Is it possible to change column name in colvis?

I found a way to change table header on click, but how to change title in colvis list?

http://live.datatables.net/jeqidove/2/

This question has an accepted answers - jump to answer

Answers

  • MisiuMisiu Posts: 68Questions: 4Answers: 2
    Answer ✓

    I've tried this:

    $(table.column(0).header()).text("Full name");
    table.settings()[0].aoColumns[0].sTitle="Full name";
    $(table.buttons()[0].inst.s.buttons[0].conf._collection).find('span:first').text("Full name");
    

    this is a bit hacky, but works.
    Maybe someone know how to do this 'official way'.
    Hope I helped

  • skikeskike Posts: 5Questions: 3Answers: 0

    Thanks! This works for me.

  • smenzersmenzer Posts: 3Questions: 1Answers: 0

    That's really hacky and requires you to manually set every single title. What happened to the label callback function described here: https://www.datatables.net/extensions/colvis/options ?

  • smenzersmenzer Posts: 3Questions: 1Answers: 0

    Note that I have looked at https://datatables.net/reference/button/colvis and don't see the callback function, so I'm wondering if it's not documented, missing, or if there's another way to accomplish this

This discussion has been closed.