on 08-24-2018 5:29 PM
Dear SAP UI5 experts,
can some one please advise on the two-way data binding of the radio buttons . In the data model I have an attribute called textType, it can return "Y" or "N", based on that I have to select the correspondent radio button on my view
<code><m:RadioButtontext="yes"selected="{path:'/textType',formatter: function(val){ if(textType== 'Y') return true; }else{ return false} }"/><m:RadioButtontext="No"selected="{Selected}"/>
however I am not able to set the value. I tried using the radiobutton group however no success
<code><RadioButtonGroupbuttons="{/textType}"><RadioButtontext="YES"selected="{Selected}"/><RadioButtontext="No"selected="{Selected}"/></RadioButtonGroup>
can some one pls advise on this .
make it (
textType
) boolean
once you use format function, it becomes oneway binding, model data will go to screen but not vice versa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the path in the selected property is given as "{selected}", I think it should be "/selected" ( assuming it is direct property binding and not originated from element binding) and It should work as I've tried it some time back.
Note: one more thing is if you put the formatter it will become one way binding, not two way, I guess you have to check that as well
Formatter functions allow one-way conversion only, while data types can also be used for two-way binding as they cannot only format, but also parse user input
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the easy way is to make the field type to boolean, or you have to use custom data type in binding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<m:RadioButton text="YES" selected ="{= ${/textType}==='YES'}" /> <m:RadioButton text="No" selected = "{=${/textType}===''}" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.