on 2019 Jan 13 10:34 PM
Hi,
In the example here: https://sapui5.hana.ondemand.com/#/sample/sap.ui.comp.sample.smartfilterbar.example2/preview a custom field is defined with a `sap.m.Select` control inside. The smart filter bar recognises changes if a new key is selected, but on saving the variant or retrieving the variant, these keys are not restored.
What's the way to include the custom field's values in the variant?
Request clarification before answering.
Hi Jorg,
You have to do it manually as Smart Filter Bar will not automatically recognize these fields.
The SmartFilterBar offers two events that can be used to enable custom fields for variant management:
You can use the beforeVariantSave event to update the model of the SmartFilterBar with the values from the custom fields. Every value within the model is stored as a variant. The values of custom fields should be stored under the property _CUSTOM, for example,
oSmartFilter.setFilterData({ _CUSTOM :{field1:"abc", field2:"123"}});
You can use the event afterVariantLoad to get the values from the model and use them to update the custom filter fields, for example:
oData = oSmartFilter.getFilterData();
var oCustomFieldData = oData["_CUSTOM"];
oCustomField1.setValue(oCustomFieldData.field1);
If both events are handled this way, custom fields are enabled for variant management.
Thanks,
Vaibhav Maheshwari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
61 | |
7 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.