cancel
Showing results for 
Search instead for 
Did you mean: 

Initial Filter in Tree table SAPUI5

Former Member

Hello,

Am trying to implement a tree table and fill data from a oData service and was successful in doing the same.

However am trying to apply a initial filter when the first odata service is triggered and tried the below code. But the filter parameters are not passed to the backend system.

Since its a tree table, the hierarchical level is always passed during the first call to Odata by default and would like to have my custom field to also be added in the filter.

var sUrl = "XXXXXXXXXXXXX";

            // set model on component
			this.getView().setModel(
                new ODataModel(sUrl, {
                	json: true,
                	batch: true
                })
            );	
			
 var oFilters = [ new sap.ui.model.Filter(
	          "OrderNumberID", "EQ", "XXXXX") ];
			
 var tab1 = this.getView().byId("TreeTableOpenOrders");
 tab1.getBinding("rows").filter(oFilters);  // No error but no data is passed

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Might help someone in the future.

The below bind row addition did the trick.

 var oFilters = [ new sap.ui.model.Filter("OrderNumberID", "EQ", "XXXXXXX") ];
			var tab1 = this.getView().byId(
			"TreeTableOpenOrders");			


            // set model on component
			this.getView().setModel(
                new ODataModel(sUrl, {
                	json: true,
                	batch: true
                })
            );	
			
			
			tab1.bindRows({
				path: "/OrderHeaders",
				filters: oFilters,
				parameters: {					
					countMode: "Inline",
					operationMode: "Server",					
					treeAnnotationProperties:  {
						hierarchyLevelFor : "HierLevel",
	                    hierarchyNodeFor : "OrderNumberID",
	                    hierarchyParentNodeFor : "SuperiorOrderNumber",
	                    hierarchyDrillStateFor : "DrillState"
					}
				}
			});

Answers (0)