on 02-27-2014 1:22 PM
Hi,
I am new to sapui5 and I wrote a simple form to edit person's information.
I attached a model to this form and bind a context when user selection changes :
var uri = "/person.xsodata";
var oModel = new sap.ui.model.odata.ODataModel(uri, true);
oModel.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);
var oForm = sap.ui.jsfragment("app.view.fragments.PersonInformation", oController);
oForm1.setModel(oModel);
[...]
oForm1.bindContext("/Person("+PersonId+")");
Then I would like to save model changes from the gender using RadioButton, I tried several function handler but was not able to fix it.
function handleSelectGender(e) {
var g = e.getSource().getSelectedItem().getKey();
oForm.getBindingContext().getObject().gender=g;
}
If then I call model.submitChanges() nothing happens, as update of Model is not detected. If I change another field and then call it updates will be taken on board.
I tried :
function handleSelectGender(e) {
var iIndex = e.getParameter("selectedIndex");
oForm.getBindingContext().getModel().setProperty("selectedIndex", iIndex);
}
But there is no update of the model.
Thanks in advance for your help.
I managed to fix it :
function handleSelectGender(e) {
var g = e.getSource().getSelectedItem().getKey();
var oBindingContext = oForm.getBindingContext();
oBindingContext.getModel().setProperty("gender", g, oBindingContext);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.