on 02-10-2017 4:19 PM
Is there a way to set up expression binding on the number property of an Object ListItem?
Here's what it's doing now...
<ObjectListItem
number="{ path: 'basket>TotalPrice', formatter: '.formatPrice'}"
>
What I need to do is set path depending on the whether {site>/ShowPrices} is true or false..
Is that possiible.
<ObjectListItem
number="{ path: = ${site>/ShowPrices} ? 'basket>TotalPrice' : '0', formatter: '.formatPrice'}"
>
E.g show the price if site>/ShowPrices is true, else show 0.
in this case its not possible, and as Veera suggested, pass both value in parts and handle and put condition in formatter function as below:
<ObjectListItem number="{ parts : [{path: 'basket>TotalPrice'},{ path : 'site>/ShowPrices'}], formatter: '.formatPrice'}">
and formatter:
formatPrice: function(totalValue, bShowPriceValue){
var formattedValue = 0;
if(bShowPriceValue){
formattedValue = totalValue;
}
return formattedValue;
}
Hope this help.
-Akhilesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You cannot use expression binding to assign a binding . You can either apply complex binding of parts
<ObjectListItem number="{ parts : [{path: 'basket>TotalPrice'},{ path : 'site>/ShowPrices'}], formatter: '.formatPrice'}">
or
<ObjectListItem number="{= ${site>/ShowPrices} ? ${basket>TotalPrice} : '0' }">
Thanks and Regards,
Veera
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you. I've need to set the value to 0 in the controller instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Expression binding can set a pre-defined constant values after evaluating the expression. In your case after the expression is evaluated you are setting a model value instead of a constant.
Possible approach would be formatter only like you did
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.