@openui5/sap.ui.core
Version:
OpenUI5 Core Library sap.ui.core
39 lines (34 loc) • 1.3 kB
JavaScript
/*!
* OpenUI5
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
/*eslint-disable max-len */
// Provides the JSON model implementation of a list binding
sap.ui.define(['sap/ui/model/ClientTreeBinding'],
function(ClientTreeBinding) {
"use strict";
/**
* @class Tree binding implementation for JSON model. See {@link sap.ui.model.json.JSONModel#bindTree}
* @hideconstructor
* @protected
* @alias sap.ui.model.json.JSONTreeBinding
* @extends sap.ui.model.ClientTreeBinding
*/
var JSONTreeBinding = ClientTreeBinding.extend("sap.ui.model.json.JSONTreeBinding");
JSONTreeBinding.prototype._saveSubContext = function(oNode, aContexts, sContextPath, sName) {
// only collect node if it is defined (and not null), because typeof null == "object"!
if (oNode && typeof oNode == "object") {
var oNodeContext = this.oModel.getContext(sContextPath + sName);
// check if there is a filter on this level applied
if (this.oCombinedFilter && !this.bIsFiltering) {
if (this.filterInfo.aFilteredContexts && this.filterInfo.aFilteredContexts.indexOf(oNodeContext) != -1) {
aContexts.push(oNodeContext);
}
} else {
aContexts.push(oNodeContext);
}
}
};
return JSONTreeBinding;
});