danielromero
6

Hi, I have this component that was defined in the lang-addon.xml as follows

<component>
<component-name>mynumberbox</component-name>
<property>
<property-name>format</property-name>
<property-value>###,###,##0</property-value>
</property>
<extends>doublebox</extends>
</component>


and, that working fine. I use this component as follows

<mynumberbox value="@bind(vm.number)" onfocus="self.select()"/>

Note that, in the onFocus attribute, I wrote "self.select()", then, in the focus event, the value is selected. That allows me a behabiour when there are a number (por ejemplo "0"), if somebody write a number "2", the value changue to "2" instead of "20". That allows a better experience for the user.

But, now I want to add the behaviour to the component definition, I thinks that can be like this

<component>
<component-name>mynumberbox</component-name>
<property>
<property-name>format</property-name>
<property-value>###,###,##0</property-value>
</property>
<property>
<property-name>onFocus</property-name>
<property-value>self.select()</property-value>
</property>
<extends>doublebox</extends>
</component>


but that not working :(

delete retag edit
Be the first one to answer this question!