-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4149161
By: yennor
Hi
I have a listbox with several columns.
What I want is, that if a text is a listcell is wider then the Column the text should be truncated, so that it perfectly fits in the column. (Perfect would be, if at the end of the text tree points "..." would be displayed, for example:
"this is a long t...").
I've tried it out with
<listcell style="white-space:nowrap;overflow:hidden" label="bla bla bal blab alb abla"/>
But unfortunately it's not working. The columns are automatically resized so that the text perfectly fits, and it's not possible to make them smaller.
Is there any possibility to achieve that?
thanks
Michael
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4150070
By: jumperchen
Hi Michael,
You can use the setMaxlength method of Lable Object ,for example :
<listcell><label maxlength="3" value="bla bla bal blab alb abla"/></listcell>
Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4150259
By: yennor
Hi Jumper
Thanks for the suggestion,
But like that i have the problem, that i need to know how many characters fit into the column (since the characters don't have the same width each, it's not that easy to calculate).
And the user is able to resize the columns. Then it should also automatically change the length of the labels (without sending a request to the server).
I'm afraid with maxlength only it won't work exactly as i'd need it, or is there a possibility?
Michael
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4155362
By: henrichen
I am afraid that maxlength is the current solution in town.
/henri
I know this is an old post but I have not seen other solutions and I had to fix it.
Example of code:
in itemrenderer
.. ...
public class MyItemRenderer implements ListitemRenderer {
public void render(Listitem li, Object data, int index) {
Object[] record = (Object[])data;
new Listcell("My short text").setParent(li);
Listcell cTesto = new Listcell("my long long text");
cTesto.setStyle("white-space:nowrap;overflow:hidden");
cTesto.setParent(li);
... ..
Best regards
Pedro Gonzalez
Maybe someone have problem with longword (Example: verylonglonglonglongword) in listcell (file *.zul). You can try with style="word-wrap:break-word". It worked in label {<row> <label value="Giá trị" style="font-weight:bold"/> <label style="word-wrap:break-word" id="lbGt"/> </row>}
Asked: 2007-02-09 15:14:01 +0800
Seen: 229 times
Last updated: Oct 23 '18