1

In the expandable row there is a " > " icon which shifts the span. When there is too much text inserted, the text is inserted into new line without proper alignment.

img1

How can I move the start of the span via css so that the new text is located under the first row of text as such?

img2

The generated HTML looks like this (minimal code sample):

<tr>
  <td>
  <span class="ui-treetable-indent"></span>
  <span class="ui-treetable-toggler ui-icon ui-icon-triangle-1-e ui-c"></span>
  <div>
    <span style="font-size: 1.1em !important; vertical-align: middle; ">
    Subrow2 with a lot of text asdasdasd asdasdqweqwdasdawdqdwqasdasdd
    </span>
  </div>
  </td>
</tr>

Here is span get placed when there is not too much text:

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
MinisX
  • 107
  • 1
  • 9

1 Answers1

1

You are probably using an older version of PrimeFaces as this is not the case in the current showcase of PrimeFaces 12.

The solution PrimeTek choose was to not wrap text in a TreeTable. See this CSS rule of the components.css:

.ui-treetable thead th, .ui-treetable tbody td, .ui-treetable tfoot td {
    overflow: hidden;
    white-space: nowrap;
    ...
}

You could add this CSS rule (with a more specific selector) to your project. See How do I override default PrimeFaces CSS with custom styles?

If you don't want the text to wrap, you could set the cell with the toggler to flex. For example:

html body .ui-treetable .ui-treetable-data>tr>td:first-child {
    display: flex;
}

html body .ui-treetable .ui-treetable-data>tr>td .ui-treetable-toggler {
    flex-shrink: 0;
}
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • Thanks a lot for great explanation! Yes, you are right, I am using PrimeFaces 11. It's great that this problem is solved in the update, but unfortunately it will take some time to update to new version ( huge project ). The first solution you have proposed I did not find nice as overflow simply gets hidden. The second one, however, worked great with a few additional properties. display: flex; width: inherit; min-width: 0; – MinisX Mar 24 '23 at 15:33