I use SAP UI5 version 1.52.6. Depending on model data, I would like to enable/disable a sap.ui.table.TreeTable view accordingly. see view:
<t:TreeTable id="tree">
<t:columns>
<t:Column>
<t:label>
<Label text="{i18n>serviceName}"/>
</t:label>
<t:template>
<Label text="{Description}" />
</t:template>
</t:Column>
</t:columns>
<t:Column>
<Label text="{i18n>serviceTechName}"/>
<t:template templateShareable="true">
<Text text="{Id}"/>
</t:template>
</t:Column>
</t:TreeTable>
Problem is that there is no method to enable the checkbox in TreeTable, see a similar topic being asked here:
How can one disable a checkbox, e.g. if model data of the row has a property called "Enabled" of true? I twould ry to avoid too much jQuery here but did not manage to grab the right attribute of the row anyways.
You might want to handle the rowSelectionChange event of the table and deselect the not desired rows explicitly, and maybe combine this with a message to the user to inform about the fact.
来源:https://stackoverflow.com/questions/49428991/enable-disable-checkbox-of-sap-ui-table-treetable-depending-on-model-data