Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

truncate long text in jsf dropdownlist h:selectOneMenu

Tags:

javascript

jsf

is there a quick way to truncate long texts displayed in h:selectOneMenu without having to code it from scratsh. what i'd like to acheive is truncating long text , and add a tooltip to display the whole text.

thanks

like image 977
Genjuro Avatar asked Jan 19 '26 20:01

Genjuro


1 Answers

You can create a utility function which will be used for truncation of long text. Example:

function shortText(String data,int length){
     return data.subString(0,length);
}

Now, instead of showing the value directly, pass the value and the length to this function, and use the return value on the UI.

like image 56
Logan Avatar answered Jan 22 '26 10:01

Logan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!