sap.ui.table.TreeTable:设置某些复选框不可见

时间:2018-03-30 13:02:26

标签: sapui5

我无法找到一种方法来移除或设置false的可见性,以查看sap.ui.table.TreeTable中特定行的复选框。

例如,对于下表,我想禁用或删除 subitem1-1 subitem1-2 subitem2-1的复选框

enter image description here

请参阅以下代码示例:



sap.ui.getCore().attachInit(function() {
  sap.ui.require([
    "sap/ui/table/TreeTable",
    "sap/ui/table/Column",
    "sap/ui/model/json/JSONModel"
  ], function(TreeTable, Column, JSONModel) {
    const treeTable = new TreeTable({
      columns: [
        new Column({
          label: "Name",
          template: "name",
        }),
      ],
      selectionMode: "MultiToggle",
      enableSelectAll: true,
    });
    treeTable.setModel(new JSONModel({
      root: {
        name: "root",
        description: "root description",
        checked: true,
        0: {
          name: "item1",
          description: "item1 description",
          checked: true,
          0: {
            name: "subitem1-1",
            description: "subitem1-1 description",
            checked: true,
          },
          1: {
            name: "subitem1-2",
            description: "subitem1-2 description",
            checked: true,
          },
        },
        1: {
          name: "item2",
          description: "item2 description",
          checked: true,
          0: {
            name: "subitem2-1",
            description: "subitem2-1 description",
            checked: true,
          },
        },
      },
    })).bindRows("/root").placeAt("content");
  });
});

<script id="sap-ui-bootstrap"
  data-sap-ui-theme="sap_belize"
  data-sap-ui-compatVersion="edge"
  data-sap-ui-preload="async"
  data-sap-ui-libs="sap.m, sap.ui.table, sap.ui.unified"
  data-sap-ui-xx-async="true"
  data-sap.ui-xx-waitForTheme="true"
  src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" 
></script>
<body id="content" class="sapUiBody sapUiSizeCompact"></body>
&#13;
&#13;
&#13;

非常感谢任何帮助或建议!

0 个答案:

没有答案