Hi All,
I am creating a fiori application where i have defined couple of fragments and calling them dynamically depending upon display/edit event (buttons are created in Main.view.xml) - Controller (Main.controller.js) has a logic to toggle between fragments and it's working fine.
Issue - In Fragment i have binded "search" event to the table and the same function is defined in the main view controller (Main.controller.js). But when i am testing the search functionality post running the application the search event is not at all getting invoked.
Not sure what exactly i am missing out, any pointers would be appreciated. Thanks!
Fragment - Deleted the table definition to reduce the content + Added the controller name in the fragment (not sure if it's required?)
<core:FragmentDefinition controllerName="QuoteApplication.Main" xmlns:core="sap.ui.core" xmlns:f="sap.ui.layout.form"
xmlns:l="sap.ui.layout" xmlns="sap.m">
........
<headerToolbar>
<Toolbar>
<SearchField id="searchField_Table" placeholder="Search" liveChange="filter" showRefreshButton="{= !${device>/support/touch}}" width="15rem"/>
</Toolbar>
</headerToolbar>
<columns>
</columns>
<ColumnListItem id="detailsListItem11" vAlign="Right" visibleRowCount="10">
<cells>
</cells>
</ColumnListItem>
</Table>
</l:content>
</l:Grid>
</core:FragmentDefinition>
Controller - Filter function defined in the Main.controller.js
_getListBinding: function() {
return this._oList.getBinding("items");
},
filter: function(oEvent) {
if (oEvent.getParameter("refreshButtonPressed")) {
this._getListBinding().refresh();
return;
}
this._sCurrentSearchTerm = oEvent.getSource().getValue();
var aFilters = [];
if (this._sCurrentSearchTerm) {
aFilters.push(new Filter("Article", FilterOperator.Contains, this._sCurrentSearchTerm));
}
// Set filters on list. Note that this replaces existing filters.
this._getListBinding().filter(aFilters, FilterType.Application);
}
Thanks
Amit Srivastava