cancel
Showing results for 
Search instead for 
Did you mean: 

Passing OData filters in XML views

Former Member
0 Kudos

Hello Experts,

I have an XML view with a sap.m.Tablecontrol in it.

The code looks like

<Table id="historyTable" noDataText="No data" items="{/OrderHistortySet}" mode="None" >

The table is bound to oData model.

I need to pass filter for the EntitySet when the table is rendered .The filter value would be available only at the runtime.

I found sap documentation Using Extended Syntax to Add Filters and Sorters - UI Development Toolkit for HTML5 (SAPUI5) - SAP L.... But this is a static filter.

How can I achieve a dynamic filter on my table in the XMLview.

Regards,

Anil

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor

<Table items = "{path : '/Tracks', filters: [{ path: 'MyApprovals', operator: 'EQ', value1: 'true'}] }">

former_member182372
Active Contributor
0 Kudos

So, it is not working for you what I posted?

Former Member
0 Kudos

Hello Maksim,

thanks for the help.

Yes it is working.

I was thinking of  making only the value part dynamic if possible.


<Table items = "{path : '/Tracks', filters: [{ path: 'MyApprovals', operator: 'EQ', value1: 'true'}] }">


Do you see any option for it ?


Regards,

Anil

former_member182372
Active Contributor
0 Kudos

that way is good for initial load , like in my example - preload only my Approvals. to change filter criteria you should use explicit method in controller.

former_member204338
Participant
0 Kudos

This message was moderated.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

This may help you,

Edit fiddle - JSFiddle

seVladimirs
Active Contributor
0 Kudos

Hi,

You can do that - you can filter out table values dynamically on user action. See small example here - JS Bin - Collaborative JavaScript Debugging&lt;/title&gt; &lt;link rel=&quot;alternate&quot; type=&q...

For more information you can always check SAPUI5 Explored

Regards,

Vladimirs

Former Member
0 Kudos

Thank you Vladimirs,

Is it not possible to pass the filter in the XML view itself ?

Anil

seVladimirs
Active Contributor
0 Kudos

I would assume you can do that by binding another JSON model which will store your filter values.

However, if I would implement "filtering" in the controller, by doing that you are more flexible

Regards,

Vladimirs