Place Sort ICON to immediate right of label

Place Sort ICON to immediate right of label

R_GR_G Posts: 31Questions: 10Answers: 0

If the fields in my table are very wide, the sort icons appear out of place. They are right justified in the field, placing them to the immediate left of the following label. This can be difficult for the user. What can I do to place them to the immediate right of the correct label?

Example Table

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Hi,

    What we need to do here is to insert an extra element into the header so it can "bump up against" the text - then we can style the extra element. There is no way to put the icon immediately after the text (at least not that I know of with CSS selectors) since we can't target the end of the text node.

    We can do this insertion in one of two ways:

    1. Manually
    2. Using a renderer

    I've put an example together using the manual approach here: http://live.datatables.net/laxohaca/1/edit . It is fairly trivial while it would actually be quite complex to create a renderer!

    Regards,
    Allan

This discussion has been closed.