3

Tooltip issue in zk ?

asked 2014-04-21 07:26:17 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

Hi There,

I am using zk 7.0.1 .I have issue related tooltip in doublebox .In the below UI show doublebox value and tooltip different .I want to show doublebox tooltip same as doublebox value.

In Zul:

     <doublebox
       value="@bind(peopleInfoData.peopleInfoRecord.infoValueNumeric)"
       hflex="1"
       format="@bind(peopleInfoData.displayFormat)"
       tooltiptext="@load(peopleInfoData.peopleInfoRecord.infoValueNumeric)"
       placeholder="@load(vm.getText('PeopleInfoDetail:ENTER_NUMBER'))"
       maxlength="20">
</doublebox>

UI:

image description

In this UI I want to show 40 in tooltip.

Can anyone help me how can resolve this Issue ?

Thanks

Sitansu

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
5

answered 2014-04-22 09:49:31 +0800

chillworld gravatar image chillworld flag of Belgium
5143 3 9
https://github.com/chillw...

updated 2014-04-23 06:43:09 +0800

2 options :

ZK have provided some built-in application level converters that are commonly used.
You can use them with name and parameters: @converter('converterName', parameterKey='value') .

Currently, built-in converter we provide are :

  1. formattedNumber
  2. formattedDate

Usage :

<label value="@load(item.price) @converter('formatedNumber', format='###,##0.00')"/>
<label value="@load(item.creationDate) @converter('formatedDate', format='yyyy/MM/dd')"/>

You should specify number or date pattern in format parameter's value for formattedNumber converter or formattedDate converter.

Option 2 :

Use a custom convertor in stead of the format from doubleBox.

Edit :
An example for your cause on zk fiddle.

Greetz chill.

link publish delete flag offensive edit

Comments

@chillworld Actually my issue is when i mouse hover in the doublebox the value 40 show 40.0 in tooltip because of doublebox not consider .0 and suppose i change the value of doublebox 40.1 its working fine .I want to ignore .0 in the tooltip .if you have any fiddle demo pls share .

sitansu ( 2014-04-22 18:38:04 +0800 )edit

Thanks @chillworld

sitansu ( 2014-04-24 05:38:57 +0800 )edit

your welcome

chillworld ( 2014-04-24 05:42:51 +0800 )edit
2

answered 2014-05-01 06:30:15 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

updated 2014-05-01 06:30:34 +0800

Alternative:

public class CustomConveter implements Converter {
    public Object coerceToUi(Object val, Component comp, BindContext ctx) {

        FormatInputElement elFormat =(FormatInputElement)comp;
        if (elFormat.getFormat() != null) {
            if(elFormat.getFormat().contains("#.#")){
                InputElement elRawValue=(InputElement)comp;

                DecimalFormat df = new DecimalFormat("#.#");
                if(elRawValue.getRawValue() != null){
                   return df.format(elRawValue.getRawValue());
                }

            }
            return val;
        }
        InputElement elRawValue=(InputElement)comp;

        DecimalFormat df = new DecimalFormat("#.#");
        if(elRawValue.getRawValue() != null){
           return df.format(elRawValue.getRawValue());
        }
        return val;
        }

        public Object coerceToBean(Object val, Component comp, BindContext ctx) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
}
link publish delete flag offensive edit
1

answered 2014-04-24 08:10:41 +0800

chillworld gravatar image chillworld flag of Belgium
5143 3 9
https://github.com/chillw...
<library-property>    
    <name>org.zkoss.bind.appConverters</name>    
    <value>abcddate=com.AbcdDateFormatConverter,abcdtooltip=com.CustomConverter</value>
</library-property>
link publish delete flag offensive edit

Comments

Thanks its work fine

sitansu ( 2014-04-24 12:43:11 +0800 )edit
0

answered 2014-04-24 07:57:22 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

updated 2014-04-24 08:04:06 +0800

@chillworld can you tell me how can i add the CustomConverter class in zk.xml before i also use Date type of conveter.

Here's zk.xml i use just like this but its not working :

<library-property>
    <name>org.zkoss.bind.appConverters</name>
    <value>abcddate=com.AbcdDateFormatConverter
    </value>
</library-property>

 <library-property>
    <name>org.zkoss.bind.appConverters</name> 
    <value>abcdtooltip=com.CustomConverter
    </value>
</library-property>

I want to use the CustomConverter.java in my zul just like this

tooltiptext="@load(peopleInfoData.peopleInfoRecord.infoValueNumeric) @converter('abcdtooltip')"
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-04-21 07:26:17 +0800

Seen: 56 times

Last updated: May 01 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More