Skip to Content
0

I want to fetch data from input list item (xml view, js controller)

Dec 13, 2017 at 04:42 PM

69

avatar image
Former Member

I want to fetch data from input list item binded to a JSON Model but I can not, I have tried everything. if there is a work around or any other solution please let me know

1.png (23.2 kB)
2.png (11.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Dec 14, 2017 at 06:47 PM
0
// Get the binded property from the lists
var myContexts = this.byId("createOrder--orderList").getBinding("items").getCurrentContexts();				
var myBoundDataObjects = myContexts.map(function(context) {
     return context.getObject();
});
// edit a certain attribute from the model
for (var i = 0; i < myBoundDataObjects.length; i++) {
     if (myBoundDataObjects[i].i_Category_ID === categoryID) {
         myBoundDataObjects[i].i_Quantity = parseInt(Qty, 10);
         break;
     }
}
// create a json model to use later from any controller
var ordersModel = new JSONModel(myBoundDataObjects);	
sap.ui.getCore().setModel(ordersModel, "ordersModel");

Thanks to boghyon

Share
10 |10000 characters needed characters left characters exceeded
Irfan Gokak Dec 14, 2017 at 06:56 AM
0

Hi,

Try binding some property to the value property of input and get it by model name.

<Input placeholder="Price" value="{someProp}"  />

// In Controller this.getView().getModel("MdlName").getProperty("/someProp");
Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you, but I have already figured that out.

Did you try to do sessions management on Fiori like app using sapui5 and Java ee

0

Welcome Ahmed. No idea how to achieve this.

0
Former Member
Irfan Gokak

I WAs able to achieve it, if you are interested just tell me and i will explain it to y

0