on 12-27-2014 8:05 AM
Hi,
Please share if there is any sample project/code to bind text field value from selected row of sap.m.table values in same view.
I was able to achieve this if text field is in different view by transferring context like this from controller.
handleListItemPress : function(evt) {
var context = evt.getSource().getBindingContext();
this.nav.to("Detail", context);
I am using single XML View and Controller .
I was able to read the data from selected row as well but unable to use it to set those values for other UI Elements.
Used below code to read selected row data.
onSelectionChange: function(oEvent){
var oSelectedItem = oEvent.getParameter("listItem");
var oSelectedItemContext = oSelectedItem.getBindingContext();
var sTableMode = oSelectedItem._mode;
var sId = oSelectedItem.getBindingContext().getProperty("id");
var sName = oSelectedItem.getBindingContext().getProperty("Name");
var age = oSelectedItem.getBindingContext().getProperty("Age");
//sap.m.alert(sId);
sap.m.MessageToast.show(sId+sName+age);
},
Regards,
Koti Reddy
I was able to use bind text fields/text using setTitle , setValue methods.Earlier I faced difficulty to set dynamic values of table selected row due to limitations to pass data between different layout controls.
Used below code from controller after modifying existing xml view under single layout control.
this.getView().byId("tf2").setValue(sId);
this.getView().byId("tf3").setValue(sName);
this.getView().byId("tf1").setValue(sId);
this.getView().byId("pn2").setVisible(true);
this.getView().byId("txtpn1").setText(sId);
this.getView().byId("txtpn2").setText(sName);
Regards,
Koti Reddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
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.