4
I would like to know if it is possible to do the following:
I need in a datatable
define a maximum height of a column. Because there are some that the text gets too long and the column value is a Yes or No, so the title gets too big. Then I thought about the possibility of breaking the title, but with a maximum height. So the text would be the size that would be ideal.
Just to make sure before proceeding with any response: this image displays the desired result?
– Cold
No. That’s what I don’t want, I’d like to limit it to a maximum of three lines in height. Problem that I realized that then use the onDemand of the first faces it can get all broken, the title in relation to the contents of the column.
– Macario1983
Even before answering... From what I see a solution would be to increase the width in such a way that we had at most 3 lines. And on the other hand, if they are dynamic columns, then the thing can complicate a little more, between so much you would have to limit to a fixed height, a considerable width and a certain limit of characters. My opinion. What do you think?
– Cold
Friend what is missing on the other side of this message is knowledge, rs. But the following I managed to do this by greatly increasing the table width stipulated a percentage value far above the dialog I use to display, so yes I managed to control the size of the columns problem is that the feature of the datatable onDemand it the times of the stick, I saw other users complaining about it too.
– Macario1983
I didn’t understand that "Friend what is missing on the other side of that message is knowledge, rs." you could explain @Macario1983?
– Cold
When you say limit to the maximum length of characters
– Macario1983
Ham, okay! So there’s no knowledge about the maximum amount of characters? Okay, if the subject has already been resolved, could you answer the question itself bro.
– Cold
Just so I understand when it comes to maximum characters, it would be to fill a test field with as much as it supports and then yes adjust?
– Macario1983
Well, I thought there might be an estimate of a maximum text for the columns (e.g., 90), and knowing that, you would adjust a maximum width (using max-width CSS) of the column in such a way that it would support at most 3 lines. I know it would be an aggressive way to solve it, but we could consider it a last chance.
– Cold
Um, I understood that you would have some dynamic algorithm that recognizes the contents of a cell and adjusts the width
– Macario1983
Um, another interesting suggestion! I think it would be less rude than the one I proposed.
– Cold
Problem is doing that
– Macario1983
The columns have the attribute "width" and the same could receive the vallor defined by the "determinaTamanho" method that receives as parameter the header text. Then it would be knowing only the ratio of x characters to y pixels. what do you think?
– Cold
I thought of something like finding a pixel multiplication * characters. But wouldn’t that slow down the page?
– Macario1983
Well, slow I do not believe, it would not be the most efficient thing in the world, more intuitively I believe it would not slow (it would be a very simple algebraic operation). I advise you to try it anyway.
– Cold
Could you post the current code in a generalized way? It would help a lot in preparing a response.
– Guill