-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Taking the following example...
<label value="@load(item.price) @converter('formatedNumber', format='###,##0.00')"/>
Is it possible to replace the '###,##0.00' value with a MVVM property? I've tried it and I get a parsing error
Also if I write a custom converter, it is possible to pass extra properties to the custom converter? In my case I want to pass a format string and a scaling factor ( x 1000000).
Something like..... Format = ####,##0.00 Scaling = 1000000
So that an input number of 4,654,654 is displayed as: 4.65
the attribute in a data binding is EL.
format=[EL-expression]
e.g. pass a string
format='aString'
For the data binding syntax, please refer to http://books.zkoss.org/zk-mvvm-book/8.0/syntax/data_binding.html
so you can write like:
<label value="@load(item.price) @converter('formatedNumber', format=vm.format)"/>
You can get a parameter by (String) ctx.getConverterArg("format");
please refer to Implement a Converter
accessing an array with EL is supported, please refer to https://github.com/zkoss/zkbooks/blob/master/mvvmreference/src/main/webapp/databinding/el.zul
I have a grid cell formatting requirement where I need to pass in two parameters:
For example:
Asked: 2019-06-13 16:03:18 +0800
Seen: 19 times
Last updated: Jun 26 '19