on 2014 Jul 07 9:14 AM
Hi Experts,
I am finding hard to define binding between the UI elements defined in the VIEW.JS by referring them in the CONTROLLER.JS. Here are some of the positive points which I could find from experts suggestions and recommendation and redefined my application in order to pull the JSON data into client.
1. I have imported an explicit JSON Data file with name ProductCategory.json. It is an array of 6 products.
2. By using loadData("","",false); I was able to load the data into the application synchronously. I could even see the same while debugging under network section.
3. Next to this I used getJSON()method to read the JSON data file into a dummy variable.Latter, the same dummy variable is used in model.setData({modelData: <dummyVAR>});
4. Now I got the reference of the table by using sap.ui.getCore().byID("tabid"); within the controller. Next to this, I tried to set the model of the table and then finally used bindRows("/modelData"); to complete the binding definition.
Now , I was expecting to see the list of 6 rows in the table. But, its not happening. Now I am little confused about where to define binding. Should it be defined in controller.js or within view.js?
Finally, this is the that way how I defined a column and its associated binding. in the view as follows
The Controller definition is as follows:
The output of the application
Regards
Pavan
Request clarification before answering.
var e_model=sap.ui.model.json.JSONModel(file address);
now give a name to your model
sap.ui.getCore().setModel(e_model,"emodel");
otab.bindRows(/emodel);
sap.ui.getCore().getModel("emodel").setData(e_model.getData());
Hope this will help you.
Regards
Umesh Singhal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.