function getSelectableCount(oPlugin) {
		const oBinding = oPlugin.getControl().getBinding();
		let iSelectableCount = -1;

		if (!oBinding || oBinding.getLength() === 0) {
			return 0;
		}

		if (_private(oPlugin).iSelectableCount != null) {
			return _private(oPlugin).iSelectableCount;
		}

		if (oBinding.getAggregation()) {
			/* In case of data aggregation with visual grouping and sum rows, we cannot determine the number of selectable contexts.
			 * The expected behavior is that if all visible selectable rows are selected, the state changes to "everything is selected". For example,
			 * the Select All checkbox should then be checked.
			 * visible rows = All rows that can be scrolled to. Does not include children of collapsed rows.
			 * selectable rows = All visible rows that are not group headers or sums.
			 * There are no values available to determine the number of selectable rows. Length, count, and selection count are all based on different
			 * criteria.
			 * The length would work for hierarchies, but there is nothing to compare it to. For example, selected contexts may be present in
			 * collapsed rows, increasing the selection count.
			 * We would have to load all contexts and check if all selectable contexts are selected. This would significantly impact performance.
			 *
			 * If the selection limit is disabled, the Select All checkbox is shown. In this case, not reaching the "everything is selected" state is
			 * not an option. Therefore, we have to accept the loss of performance.
			 *
			 * As a consequence:
			 * - The "everything is selected" state is never reached.
			 * - If the visible rows in the table are all group headers or sums, the header selector is enabled, but pressing it has no effect.
			 * - If the selection limit is disabled, the "everything is selected" state is reached when it shouldn't be if there are invisible
			 *   selected contexts, for example, in collapsed rows.
			 */
			if (oPlugin._isLimitDisabled()) {
				const aAllCurrentContexts = oBinding.getAllCurrentContexts();
				if (oBinding.getLength() === aAllCurrentContexts.length) {
					iSelectableCount = aAllCurrentContexts.filter(isContextSelectable).length;
				}
			}
		} else if (oBinding.isLengthFinal()) {
			iSelectableCount = oBinding.getLength();
		} // The count is not requested and not all data is loaded.

		_private(oPlugin).iSelectableCount = iSelectableCount;
		return iSelectableCount;
	}
Returns the number of selectable rows.

@param {sap.ui.table.plugins.ODataV4Selection} oPlugin The plugin to getthe number of selectable rows from.
@returns {int} The number of selectable rows, or -1 if the number cannot be determined.