Skip to Content
0

json file is not found

Feb 03, 2017 at 08:27 AM

96

avatar image

I am trying to access my json file which is in model folders through my xml view but its showing me the following error

The following problem occurred: error - <html><head></head><body>File sap/zclub5/model/club/json NOT found!</body></html>,404,NOT FOUND

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Suriyanarayanan Balamurugan
Feb 03, 2017 at 10:33 AM
0

Hi,

Try the below code

var model =newsap.ui.model.json.JSONModel();
var path = jQuery.sap.getModulePath("club");

 //for the below code too work you have to move your model folder inside the club folder 
model.loadData(path +"/model/club.json");
 //else use below code

model.loadData(path +"/../model/club.json");


Regards,

Suriya

Share
10 |10000 characters needed characters left characters exceeded
VAIBHAV GB Feb 03, 2017 at 09:01 AM
2

Hey Yadnesh,

Please try this code in you controller:

var model = new sap.ui.model.json.JSONModel();
var path = jQuery.sap.getModulePath("club");
model.loadData(path + "/model/club.json");
var _self = this;
model.attachRequestCompleted(function(){
_self.getView().setModel(model);
});

Regards

GB


                            
Show 2 Share
10 |10000 characters needed characters left characters exceeded

error is gone but still the data isn't getting displayed

0

its done thank you very much.

0
Yadnesh Kombe Feb 03, 2017 at 08:40 AM
0

These are the files i have used in my app

view file view.png

controller file controller.png

index file index.png

json json.png


view.png (60.4 kB)
controller.png (95.7 kB)
index.png (95.7 kB)
json.png (81.5 kB)
Share
10 |10000 characters needed characters left characters exceeded