Skip to Content
0
Feb 08, 2017 at 04:32 PM

When Tree table opens first time expandToLevel() not working

179 Views Last edit Feb 09, 2017 at 10:30 AM 3 rev

Hi All,

I have a button, when I click on it I am opening a fragment which is having tree table shown in Dialog . Here issue is I am using

var oTable = sap.ui.getCore().byId("treeTable");
		oTable.expandToLevel(2);

when fragment is opening for first for first time expandToLevel() is not applying. when I closed the Dialog and open again expandToLevel() is working. Below is my fragment code.

	onEdit:function(){
		
		var sService = "/sap/opu/odata/sap/ZEntity_SRV/" ;
		var oModel = new sap.ui.model.odata.v2.ODataModel(sService , {useBatch : false });	
		if (! this._oDialog) {
		      this._oDialog = sap.ui.xmlfragment("crm.fragmenTreeSelect", this);
		    } 
		
		this.getView().addDependent(this._oDialog);
		this._oDialog.setModel((oModel),"TreeselectTable" );
		this._oDialog.setContentWidth("480px");
		this._oDialog.open();
		var oTable = sap.ui.getCore().byId("treeTable");
		oTable.expandToLevel(2);
	
	},
	

Could anyone please help here how to apply expandToLevel() first time of opening table.

Thanks,

Best Regards,

Viswanath