cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass additional filter to sap.ui.treeTable?

Jayakrishnan
Active Participant
0 Kudos
1,275

Hi All,

I am working on SAPUI5 Custom development. In my application scenario, i need to use Treatable to display the values in hierarchy level. I followed the below SAPUI5 Explored example to do that.

Link : Tree Table with Annotaions

It is working as expected.

View.xml:

<TreeTable id="treeTable" selectionMode="None" enableColumnReordering="false" 
alternateRowColors="true" rows="{ path : 'test>/TreeViewTestSet', parameters : { countMode: 'Request', numberOfExpandedLevels: 0 } }">
    <columns>
        <Column hAlign="Center" width="12em">
            <m:Label text="{i18n>master_form_label_plant}" design="Bold"/>
            <template>
                <m:Text text="{test>Description}" wrapping="false"/>
            </template>
        </Column>
</TreeTable>

Now i need to pass the additional filter to this Treatable Collection. I dont know how to pass the additional filters to the table.

I tried the below approach to enable the filter, but it does not works. I had a thought of sending the required filters to the entityset via controller and tried to bind the response to the sap.ui.treeTable aggregations.

Below code which i tried:

oModel.read("/TreeViewTestSet", {
				filters: aDateFilter,//my additional filters
				success: function (results, response) {
					debugger;
					
					that.getModel("test")
						.setProperty("/TreeViewTestSet", results);
						
					//how to update this model to my sap.ui.treeTable.
					
				},
				error: function (oError) {
					MessageToast.show("Error");
				}
			});

It does not work, when i try to use bindRows method for the treeTable, it starts from the hierarchylevel 0 without the date value (i applied via filter).

Thank you,

Regards,

JK.

Accepted Solutions (0)

Answers (2)

Answers (2)

Jayakrishnan
Active Participant
0 Kudos

Hi I got the solution. I used the aggrgation in both places, view and controller. so that whatever the chnages i did in the controller is overridden at view. Now i removed the rows aggreagtion in the view, fully maintained in the controller by using the id and bindRows() method.

former_member312987
Active Participant
0 Kudos

Try .setData and check the path/structure

Jayakrishnan
Active Participant
0 Kudos

Hi raquel.martinbarry Thanks for your reply.

Where to add those line?

Thanks ,

JK.