sap.m.Table
(aka. Responsive Table)
Currently, there is no publicly documented API to enable/disable showing the "Select All"-CheckBox on sap.m.Table. Best practice in this case is to extend the control and to switch the bPreventMassSelection state accordingly.
Here is a snippet from the sample: https://embed.plnkr.co/pnpdRK7d7CxZXZ8s
sap.ui.define([
"sap/m/Table",
"sap/m/TableRenderer",
], function(Table, TableRenderer) {
"use strict";
return Table.extend("demo.control.MyResponsiveTable", {
metadata: {
properties: {
showSelectAll: {
type: "boolean",
bindable: true,
},
},
},
setShowSelectAll: function(bValue) {
this.bPreventMassSelection = !bValue;
this.setProperty("showSelectAll", bValue);
return this;
},
renderer: TableRenderer,
});
});
<demo:MyResponsiveTable xmlns:demo="demo.control"
showSelectAll="{/showSelectAll}"
mode="MultiSelect">
Compared to _getSelectAllCheckbox, the above approach should be favored since:
_getSelectAllCheckbox is a private method.
- Private methods are not intended to be used outside of the control definition.
- Relying on private methods and/or manipulating the internal control (
CheckBox) will break the app in future UI5 releases.
- The
bPreventMassSelection on the other hand is a simple flag which is already used widely in other controls that rely on sap.m.Table/.List internally. We can see that Table skips rendering the "Select All"-CheckBox if bPreventMassSelection is enabled.
sap.ui.table.Table
(aka. Grid Table)
In case someone was looking for the solution but with sap.ui.table.Table, set the enableSelectAll property to false:
<table:Table xmlns:table="sap.ui.table"
enableSelectAll="false"
selectionMode="MultiToggle">