Skip to Content
0
Former Member
May 10, 2015 at 05:01 PM

Fiori change json data binding in XML View

288 Views

Hallo,

i am using Fiori Trial Edition and there i am creating a Master/Detail App. The Master gets input via model/metadata.html and abc.json.

now i want to replace the SearchField with a combobox for selecting "month":

so i created a 2nd json file with this content and called it month.json

{

"Month": [

{

"key" : "1" ,

"name" : "January"

},

{

"key" : "2" ,

"name" : "February"

}]

}

so my problem is: how can i do that and explain fiori in XML VIEW that i want to use another json file for input?

In the Link above:

one answer there is:

and your ComboBox would then be set up as follows:

<ComboBox items="{/Month}">

<items>

<core:Item key="{key}" text="{name}"/>

</items>

</ComboBox>


BUT i want to save that "Month" to a new json file, and tell in XML that the Combobox shall use another json... like <Combobox items="/Month" referenceToJsonFile = "newJsonFile.json).


please help thanks!



if i add the coding marked in bold this to the onInit(), the app does not work.


onInit: function() {

this.oInitialLoadFinishedDeferred = jQuery.Deferred();

var oEventBus = this.getEventBus();

oEventBus.subscribe("Detail", "TabChanged", this.onDetailTabChanged, this);

var oList = this.getView().byId("list");

oList.attachEvent("updateFinished", function() {

this.oInitialLoadFinishedDeferred.resolve();

oEventBus.publish("Master", "InitialLoadFinished");

}, this);

//On phone devices, there is nothing to select from the list. There is no need to attach events.

if (sap.ui.Device.system.phone) {

return;

}

this.getRouter().attachRoutePatternMatched(this.onRouteMatched, this);

oEventBus.subscribe("Detail", "Changed", this.onDetailChanged, this);

oEventBus.subscribe("Detail", "NotFound", this.onNotFound, this);

var demoJSONModel = new sap.ui.model.json.JSONModel({

data : [

{ name : "January" },

{ name : "February" },

{ name : "March" }

]

});

sap.ui.getCore().getElementById("mySelectMenu").setModel(

demoJSONModel);

},