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
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
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
error is gone but still the data isn't getting displayed
its done thank you very much.
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