Skip to Content

How to load json in fiorilaunchpad

Hi i'm triying to load my json data in launchpad but tells me that Not Found, look

i loaded it in my manifest

	"models": {
	  "i18n": {
		"type": "sap.ui.model.resource.ResourceModel",
		"settings": {
		  "bundleName": "crm.prospecto.i18n.i18n"
		}
	  },
	  
	  	  
	  "comunas": {
	  	"type": "sap.ui.model.resource.ResourceModel",
	  	"settings": {
	  		"bundleName": "crm.prospecto.model.comunas"
	  	}
	  }
	
     }

and this is where it's my combobox

<ComboBox 	id="comboComuna"
											showSecondaryValues= "true"
								          	items="{path: '/V_ADRCTPRT'}">
								<core:ListItem key="{cod_comuna}-{cod_pob}" text="{nomb_comuna}" additionalText = "{ciudad}" class="cssComuna"/>
								</ComboBox>
								

this is my controller , and with this way i get the error:

Uncaught Error: resource URL './model/comunas' has unknown type (should be one of .properties,.hdbtextbundle)

	         var sRootPath = jQuery.sap.getModulePath("crm.prospecto") + "/" + "model/comunas"
	         var resourceBundle = jQuery.sap.resources({
	        	 url : sRootPath
	         });
	         
	         var localData = new JSONModel();
	         localData.loadData(resourceBundle);
	         localData.setSizeLimit(200);
	         this.getView().byId("comboComuna").setModel(localData);
	         
	         oDialog.open();

and i tried like this:

         var localData = new JSONModel();
         localData.loadData("model/comunas.json");
         localData.setSizeLimit(200);
         this.getView().byId("comboComuna").setModel(localData);

         oDialog.open();

if i open my app not inf fiori launchpad it works but when i open in my launchpad i get a Not Found Error

So how shoud i set my json data so it can be displayed stand alone and in my fiori launchpad ???

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 23 at 03:11 PM

    Well i answer myself , i used the full path insted the relative

                     var localData = new JSONModel();
    	         localData.loadData("/sap/bc/ui5_ui5/sap/ZCRM_PROSPECTOS/model/comunas.json");
    	         localData.setSizeLimit(200);
    	         this.getView().byId("comboComuna").setModel(localData);


    this helped me to undestnad: https://sapui5.hana.ondemand.com/#/api/sap.ui.model.json.JSONModel/methods/loadData

    and this is the answer:

    https://archive.sap.com/discussions/thread/3688347

    Add comment
    10|10000 characters needed characters exceeded