cancel
Showing results for 
Search instead for 
Did you mean: 

Search Children in SAPUI5

moorthy_s
Explorer

Hi Techies,

I have a nested table in XML view. I have a search bar and need to search the child element in UI5. My Json structure is like below,

"headerList": [{ "Material": "0950418867", "Plant": "1C03", "MaterialType": "1045", "Procurement": "E", "itemsList": [{ "Component": "87566340", "Description": "Mat1", "Quantity": "10", "Prod": "true", "Cost": "X", "SortString": "1" }, { "Component": "875663401", "Description": "Mat2", "Quantity": "10", "Prod": "true", "Cost": "X", "SortString": "1" }, { "Component": "875663402", "Description": "Mat3", "Quantity": "10", "Prod": "true", "Cost": "X", "SortString": "1" }] }

I using Filter operation to search with material like

"headerList": [{ "Material": "0950418867", "Plant": "1C03", "MaterialType": "1045", "Procurement": "E", "itemsList": [{ "Component": "87566340", "Description": "Mat1", "Quantity": "10", "Prod": "true", "Cost": "X", "SortString": "1" }, { "Component": "875663401", "Description": "Mat2", "Quantity": "10", "Prod": "true", "Cost": "X", "SortString": "1" }, { "Component": "875663402", "Description": "Mat3", "Quantity": "10", "Prod": "true", "Cost": "X", "SortString": "1" }] }



return new Filter({
filters: [
new Filter("Material", FilterOperator.Contains, sQuery),//It's working

new Filter("headerList/itemsList/Component", FilterOperator.Contains, sQuery) //It's not working.
],
and: false
});


When i try to search the Child element like above its not working. Can you please suggest the correct way. Thanks in advance.
View Entire Topic
ramakrishnappa
Active Contributor
0 Kudos

Hi Moorthy,

You need to directly use the name of the field to be filtered, in your example, use "Component" in filter condition as below.

new Filter("Component", FilterOperator.Contains, sQuery)

Hope this helps you.

Regards,

Rama