cancel
Showing results for 
Search instead for 
Did you mean: 

problem using two way binding of json model..

Former Member
0 Kudos

Hey,

I am trying to bind sapui5 controls to a json model using bind value & bind property as shown


miApprovalDatePicker.bindValue("UIModel>/issueDate");

miApprovalDatePicker.bindProperty("value","UIModel>/approvalDate");

UIModel is the json Model which i have declared in my onit: of controller as shown


var UIModelCore = new woodsoftui5.model.MaterialIssueOrder();

        var UIModelJson = new sap.ui.model.json.JSONModel();

        UIModelJson.setData(UIModelCore);

        sap.ui.getCore().setModel(UIModelJson,"UIModel");

but i have a similar model which i use it to save data when i search using Ajax service where i am setting data to both UIModel &  miModeljson

I am comparing if there is any change in UIModel &  miModeljson in my save function as shown


miSave: function (showPrintOrder) {

        var UIModel = sap.ui.getCore().getModel("UIModel");

   

      

        /****Checking if there is any change in values in ui and values obtained from data base*******************/

        if (!(_.isEqual(miModelJson.oData, UIModel.oData))) {.....Ajax call for save...}

the problem is that the values of the controls are also binding to miModelJson which i think a problem with twoWay binding which is new to me!!!!

The whole thing i am doing is to eliminate Ajax for Save,

please help...............

regards,

Raghu

thelJson

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182862
Active Contributor
0 Kudos

Sorry Raghu

I have difficulty understanding the issues that you are facing.

Are you trying to keep a copy of the data so that you can check if original data is changed?

-D