Skip to Content
0

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

Mar 15, 2017 at 09:18 AM

56

avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Srikanth KV Mar 15, 2017 at 06:44 PM
1

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

Show 1 Share
10 |10000 characters needed characters left 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

0
Jun Wu Mar 15, 2017 at 12:04 PM
0

your code?

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

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Jun,

I used json model, and it does have no child icon if it doesn't.

And now I want to make it dynamic, because if there are a lot of data, load them all into json model spends a lot of time.

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

0

how much data you are talking about?

0
Former Member
Jun Wu

Hi Jun,

Just like the picture I post,

It's really not a big data.

Thanks&Best Regards,

Wead

0

then what's point to load on demand?

0