"extends": {
"extensions": {
"sap.ui.controllerExtensions": {
"sap.suite.ui.generic.template.ListReport.view.ListReport": {
"controllerName": "<namespace>.ext.controller.ListReportExt",
"sap.ui.generic.app": {
"ZTEST_INFO": {
"EntitySet": "ZTEST_INFO",
"Actions": {
"TestAction": {
"id": "ActionBtn",
"text": "{@i18n>TestAction}",
"press": "onClickDisplayDocument"
}
}
}
}
}
},
"sap.ui.viewExtensions": {
"sap.suite.ui.generic.template.ListReport.view.ListReport": {
"SmartFilterBarControlConfigurationExtension|ZTEST_INFO": {
"className": "sap.ui.core.Fragment",
"fragmentName": "<namespace>.ext.fragment.CustomFilter",
"type": "XML"
},
"GridTableColumnsExtension|ZTEST_INFO": {
"className": "sap.ui.core.Fragment",
"fragmentName": "<namespace>.ext.fragment.CustomColumn",
"type": "XML"
}
}
}
}
}
<core:FragmentDefinition xmlns="sap.m" xmlns:smartfilterbar="sap.ui.comp.smartfilterbar" xmlns:core="sap.ui.core">
<!-- My Custom Filter-->
<smartfilterbar:ControlConfiguration key="CustomIndicator1042Filter" index="30"
label="{i18n|sap.suite.ui.generic.template.ListReport|ZTEST_INFO>Indicator1042Filter}" id="CustomVH1042Indicator">
<smartfilterbar:customControl>
<ComboBox id="CustomIndicator1042Filter-combobox" selectedKey="0" selectionChange="on1024FilterSelection">
<core:Item id="CustomIndicator1042FilterItem0" key="0"
text="{i18n|sap.suite.ui.generic.template.ListReport|ZTEST_INFO>all}"/>
<core:Item id="CustomIndicator1042FilterItem1" key="1"
text="{i18n|sap.suite.ui.generic.template.ListReport|ZTEST_INFO>yes}"/>
<core:Item id="CustomIndicator1042FilterItem2" key="2"
text="{i18n|sap.suite.ui.generic.template.ListReport|ZTEST_INFO>no}"/>
</ComboBox>
</smartfilterbar:customControl>
</smartfilterbar:ControlConfiguration>
</core:FragmentDefinition>
onBeforeRebindTableExtension: function(oEvent) {
//Filter Logic
}
onBeforeRebindTableExtension: function(oEvent) {
var smartTable = oEvent.getSource();
var oTable = smartTable.getTable();
//Read $fiter params to pass selected value in custom filter
var oBindingParams = oEvent.getParameter("bindingParams");
oBindingParams.parameters = oBindingParams.parameters || {};
var oSmartFilterBar = this.byId(oSmartTable.getSmartFilterId());
var vCategory;
if (oSmartFilterBar instanceof sap.ui.comp.smartfilterbar.SmartFilterBar) {
//Custom Indicator1042 filter
var oCustomControl = oSmartFilterBar.getControlByKey("CustomIndicator1042Filter");
if (oCustomControl instanceof sap.m.ComboBox) {
vCategory = oCustomControl.getSelectedKey();
switch (vCategory) {
case "1":
oBindingParams.filters.push(new sap.ui.model.Filter("Indicator1042", "EQ", "Yes"));
break;
case "2":
oBindingParams.filters.push(new sap.ui.model.Filter("Indicator1042", "EQ", "No"));
break;
default:
break;
}
}
}
}
<smartfilterbar:customControl>
<MultiComboBox id="combobox" items="{ path: '/EntitySet', sorter: { path: 'SortProperty' } }"
selectionChange="onChange">
<core:Item key="{key}" text="{Value}-{Text}"/>
</MultiComboBox>
</smartfilterbar:customControl>
@Consumption:{valueHelp: '_assoc'}
key propertyname,
*** Call Super Method
super->define( ).
*** Local Data Declaration
DATA lo_entity_type TYPE REF TO /iwbep/if_mgw_odata_entity_typ.
DATA lo_property TYPE REF TO /iwbep/if_mgw_odata_property.
*** Set the drop-down annotations for property ekorg of entity:
lo_entity_type = model->get_entity_type( 'ZTEST_INFOType' ).
IF lo_entity_type IS NOT INITIAL.
"Set ekorg as fixed-value list:
lo_property = lo_entity_type->get_property( iv_property_name = 'propertyname' ).
IF lo_property IS NOT INITIAL.
lo_property->set_value_list(
iv_value_list_type = /iwbep/if_mgw_odata_property=>gcs_value_list_type_property-fixed_values
).
ENDIF.
ENDIF.
@Consumption.filter.defaultValue: '111'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |