Skip to Content
0

SAPUI5 issue?

Jan 31, 2017 at 10:59 AM

156

avatar image

Hi Experts,

I design one UI on Eclipse.Which displays one Form Control with 4 fields, these fields will be update based on Row Selection of a Table Control data.This table contains number of records and one toggle button on toolbar named as Change.The data will be changed when user pressed on Change Button. After changes has been done , that data was not reflects on FORM Control when user press on any row. Previous data only displays . you can check the below attached pic....

Could anybody look into this and give the solution...

Thanks,

Vamsi.

ui5.jpg (84.5 kB)
10 |10000 characters needed characters left characters exceeded

Code please ? .. might be you are not refreshing the binding of form control

thanks

Viplove

0

Hi vip,

Thanks for the reply...

how to refresh the Binding of Form Control..

give me syntax..

and here is my code for Change Button:

switchModel:function(oEvent){
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
/*debugger;*/
var selValue = oEvent.getParameter("pressed");
var oCore = sap.ui.getCore().byId("myTable");
var oModel = oCore.getModel();
/*debugger;*/
var oVamc = oCore.getModel("VAMC");
oCore.setModel(oModel,"VAMC");
oCore.setModel(oVamc);
},

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

For Row Selection:

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

rowSelect:function(oEvent){
debugger;
var oForm = new sap.ui.getCore().byId("myForm");
var oElement = {

path : oEvent.getParameter("rowContext").getPath()
};
/*debugger;*/
oForm.bindElement(oElement);
}

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Code In my VIEW :

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

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

//oModel.setData(myData);
oModel.loadData("Model/oModel.json") ;

sap.ui.getCore().setModel(oModel);

var oModel1 = new sap.ui.model.json.JSONModel();
oModel1.loadData("Model/oModel1.json");
sap.ui.getCore().setModel(oModel1, "VAMC")



var oLbl1 = new sap.ui.commons.Label({text: "empNo"});
var oTxt1 = new sap.ui.commons.TextField({
width:"60px",
value:"{empNo}"
});

var oLbl2 = new sap.ui.commons.Label({text: "empName"});
var oTxt2 = new sap.ui.commons.TextField({width:"100px"});
oTxt2.bindValue("empName")

var oLbl3 = new sap.ui.commons.Label({text: "salary"});
var oTxt3 = new sap.ui.commons.TextField({width:"60px"});
oTxt3.bindProperty("value", "salary")

var oLbl4 = new sap.ui.commons.Label({text: "currency"});
var oTxt4 = new sap.ui.commons.TextField({
width:"40px",
value:{path:"currency"}
});


var sForm = new sap.ui.commons.form.SimpleForm("myForm", {

/*title : new sap.ui.core.Title({text:"Employee Data"}) ,*/
title : "Employee Information" ,
content: [

oLbl1 , oTxt1 ,
oLbl2 , oTxt2 ,
oLbl3 , oTxt3 ,
oLbl4 , oTxt4 ]
});

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

You can observe two JSON Models are there...

One is i called by default and another one is using name "VAMC"...

when we click on Change toolbar Button then the data is coming from "VAMC" named Json model Object .

Thanks,

Vamsi.

0

Hello,

Please, do not code into your Views !!! don't forget the MVC paradigm !

By the way the Best practice is to use XML views. If you follow this, you will see it will become easier for you to code and debug your UI5 application.

Best regards,

Joseph

0

Thanks Joseph for your information...

0
* Please Login or Register to Answer, Follow or Comment.

4 Answers

VIPLOVE KHUSHALANI Feb 01, 2017 at 08:59 AM
0

Hi

Why you are using 'new' in row selection function ?

var oForm = new sap.ui.getCore().byId("myForm");

Thanks

Viplove

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 24, 2017 at 10:59 AM
0

Hi,

Why not simply update the model bound to form in Row Selection method.

Since by default model is two way, if you simply update Form model, it will be reflected in form also.

Rohit

Share
10 |10000 characters needed characters left characters exceeded
vamsilakshman pendurti Mar 01, 2017 at 09:25 AM
0

Hi,

Thank you all for immediate reaction...

Issue has been resolved.

There is a mistake in my code itself...i.e.,

var oCore = sap.ui.getCore().byId("myTable");

the above line in my code is replaced with...

var oCore = sap.ui.getCore();

Now its working fine...

Thanks,

Vamsi.

Share
10 |10000 characters needed characters left characters exceeded
Arjun Biswas Sep 25, 2017 at 10:33 AM
0

Find out the attachRowSelectionChange method.It is in the library sap.ui.table.

Regards,

Share
10 |10000 characters needed characters left characters exceeded