Column Buttons not copying the breaks setup in the table column names

Column Buttons not copying the breaks setup in the table column names

minifiredragonminifiredragon Posts: 82Questions: 16Answers: 2

I added this to the table:
buttons: [ { extend:'columnsToggle', }, ]

Which give me the nice row of column buttons at the top to show and hide the columns with a click. HOWEVER! It does not copy the <br> that I put in my table names to shorten the column widths so my column button row does not sit nicely above the table.

Looking at the generated code on the web page, I can see the <br> in my table column, but not in my column buttons. And no amount of text wrapping to wrap on space is changing the button.

Anyway to fix this or add it into a future update?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    The button text intentionally strips HTML tags to show just the column name. The buttons, but default, are designed to be single rows of text, not flowing over multiple lines. You could perhaps add a suitable max-width to the buttons?

    Failing that, can you link to a page showing the issue so I can see the specifics?

    Allan

  • minifiredragonminifiredragon Posts: 82Questions: 16Answers: 2

    Unfortunately I cannot link the page. And the page has over 70 columns in it that are essentially auto generated, so it would take alot of time to even make a demo.

    I did get the wrap to work with max-width. I forgot that I needed to use that to have white-space work (late night). But I think it would be a nice feature to have a flag to keep the assigned breaks in the column to be added to the button.

    Why?:
    What I have built here is a table creator. I allow the user to select the columns they want to see, in the order they want to see them and then save the column list which they can then load from a drop down or a bookmark. This one table spans over 70 columns. And when I cluster them just to fit into the screen. There is alot of back and forth scrolling. When I string them out, the buttons can sometimes outrun the length of the table, so more scrolling back and forth.

    Since the table is built where the column names are already pre-broken down to the width they need to be to show in the template with breaks, it would be nice for the buttons above to be able to line up with their respective columns below (or even the button use it's columns width). The max-width is kind of hacky and does not quite make them fit correctly, but close enough for now.

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin
    Answer ✓

    Good to hear you got a workaround. I'll keep an eye out for similar requests and add them to the vote to add a feature toggle to handle this kind of thing.

    Allan

Sign In or Register to comment.