1

I wanted to pass the value to filter option in run-time. Below is the code, I just tried and it is not working. can anyone please tell me that, how can I achieve this option ?

<l:VerticalLayout width="100%" id="idRENT_CAR_DET" 
 content="{path:'/Trip_section/Rental_det', 
 filters : { path : 'TripId', 
            operator :'EQ', 
            value1: '{ path :'Trip_section>/TripId'}' } }" > 
<l:Grid defaultSpan="L2 M6 S6" minWidth="1024"> 
<m:Input value="{From}" type="Date"/> 
<m:Input value="{To}" type="Date" /> 
<m:HBox> 
<m:Button id="idRCBTN" icon="sap-icon://sys-add"/> 
<m:Button icon="sap-icon://sys-cancel" /> 
</m:HBox> </l:Grid> </l:VerticalLayout>
Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48
Mahendran N
  • 11
  • 1
  • 3
  • http://stackoverflow.com/questions/25387580/not-possible-to-set-filter-value-using-data-binding – Sunil B N Dec 28 '15 at 10:16
  • For future reference, the answer can be found here http://stackoverflow.com/questions/36794281/correct-usage-for-filters-when-binding-items-via-xmlview – Matti.b Dec 07 '16 at 12:42

1 Answers1

1

I haven't ran your code but your xml formatting is wrong.

You must use different characters for '

'{ path :'Trip_section>/TripId'}'

Maybe it would be the best if you apply the filter to your view in your controller.

var aFilter = [];
var sQuery = oEvent.getParameter("query");
if (sQuery) {
    aFilter.push(new Filter("ProductName", FilterOperator.Contains, sQuery));
}
var oVerticalLayout = this.getView().byId("theGivenId...");
var oBinding = oVerticalLayout.getBinding("content");
oBinding.filter(aFilter);

Maybe the binding isn't available in the onInit function.

I wish you good luck.

Arwed Mett
  • 2,614
  • 1
  • 22
  • 35