Skip to Content
avatar image
Former Member

How to make rows of one certain level in sap.ui.table.TreeTable un-expandable?

Dear All,

Is there any way to make rows of one certain level in sap.ui.table.TreeTable un-expandable?

For example, I want to made all the level '4' rows un-expandable(invisible the expand arrow).

In my picture:

you see the level 4 row 'FK1' doesn't have the expand arrow, actually it had just like the row 'SYS', but after I click it, it sends request to backend service, it will get no child nodes so it disappear.

I'm sure all the 4 level rows don't have child nodes, so I want to make them un-expandable or invisible the expand arrows,

Could you please kindly help me ?

Best Regards,

Wead

4.png (48.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 15, 2017 at 06:44 PM

    As per your code/design there is no way to determine that node 'FK1' wont have any child nodes without triggering backend request, so tree UI control by default assumes that there might be some child controls and gives the 'expand' option.

    if you want to unexpand a node or assuming that node is a leaf then you should load all the data before the control instantiation and bind it using local json model

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Srikanth,

      Actually in the past I was using JSONModel and load all data from xsjs service then display, but now I'm using OData binding because it's dynamic, and will not spend a lot time at first to load the data.

      So in my case, there is no way to achieve it, right? :)

      Here is my code:

      var oTable = this.getView().byId("idTable");
      			var sServiceUrl = "/services/odata/svt/sbasystemdatasrv";
      			var oModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl, {
      				useBatch: false
      			});
      			oModel.attachRequestSent(function(oEvent){
      				
      			});
      			oModel.attachRequestCompleted(function(oEvent){
      				
      			});
      			//this.treeBinding = new sap.ui.model.odata.v2.ODataTreeBinding(oModel);
      			oTable.setModel(oModel);
      
      
      			//navigation service binding
      			oTable.bindRows({
      				path: "/custHierarchySet",
      				numberOfExpandedLevels : 4,
      //				filters: [new sap.ui.model.Filter("Name", sap.ui.model.FilterOperator.EQ, "Fiori")],
      				parameters: {
      					expand: "ChildNodes",
      					countMode: "Inline",
      					navigation: {
      						
      						"custHierarchySet": "ChildNodes"
      					}
      				}
      			});

      Thanks & Best Regards,

      Wead

  • Mar 15, 2017 at 12:04 PM

    your code?

    i am using json model, I don't see that icon if it has no child.

    Add comment
    10|10000 characters needed characters exceeded