oData model and JSON model have different Binding Contexts (sPath)

问题内容:

When I bind a oData Service directly on a table my Binding Context looks like

/Customer('ALFKI')

When I read the oData into a JSON model and bind the JSON Model to a table my Binding Context looks like

/Customer/1

How can I make the JSON Model have the same look as the oData Model?

reading oData, and saving the results into the JSON model “Customer”

            oODataModel.read("/" + sPath, {
            filters: aFilters,
            sorter: aSorter,
            success: function(oData, response) {
                console.log(oData.results);
                oControl.setModel(oModelJson, sJsonModel);
                oModelJson.setData({
                    "Customer": oData.results
                });

I could iterate the oData result and create a key for each entry, like

sPath = oODataModel.createKey("/" + "ArticleListSet", oContectObject);

.. but, Is there a better option to achive this?

I looked into further oData binding examples, like Addressing Entities: Binding Path Sytnax

问题评论:

原文地址:

https://stackoverflow.com/questions/47756440/odata-model-and-json-model-have-different-binding-contexts-spath

添加评论

友情链接:蝴蝶教程