我有一个TreeTable,它显示来自oData服务的数据。一些数据字段包含斜杠符号(“/”,f.e。cats / dogs)。我的服务将它们理解为一种新的参数,并且不会在TreeTable中显示它们(给出一个空行)。
这是我的代码:
oData = new sap.ui.model.odata.ODataModel(".../categories/categories.xsodata/", false);
oData.read("/Categories/",
null,
null,
false,
function(oData, oResponse){
flat = {};
for (var i = 0; i < oData.results.length; ++i) {
var item, group, type, code;
var getSubNode = function(obj, key) {
if (!obj[key]) {
obj[key] = {'NAME': key}
}
return obj[key];
};
item = oData.results[i];
group = getSubNode(flat, item.PET_GROUP);
type = getSubNode(group, item.PET_TYPE);
item.NAME = item.GENDER;
item.__metadata = "";
type[item.GENDER] = item;
}
data = {flat : flat,};
});
ojModel = new sap.ui.model.json.JSONModel();
ojModel.setData(data);
oTable.setModel(ojModel);
oTable.bindRows("/flat");
return oTable;
也许这有解决方案?