on 2022 Feb 10 3:31 PM
Hello,
I created a service based on a CDS view and used it to create a worklist app with a smart filter bar and smart table. I also used annotations to add value helps. My problem is that for some filters I want the user to be able to filter on values of their choosing, even if the Value Help doesn't return these values. Right now if a value is entered that is not returned from the service, the field's state becomes an Error state and the message "Invalid entry" appears.
How do I prevent this?
Thanks,
I have achieved the required behavior by adding a listener on the "initialized" event of the smart filter bar, and removed all validators from that control:
onFilterBarInitialized: function(oEvent){
var oFilterControl = oEvent.getSource().getControlByKey("<KEY>");
if(oFilterControl){
oFilterControl.removeAllValidators();
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The best way is definitely do a custom filter item as xtrnhfo suggested. It's easier than you think. But since you already told you don't want to, the only way I see is by manually change the property "showSuggestion" of the control and also remove the "suggest" event from its event registry.
Something like this:
Controller::onInit
this.byId("smartFilterBar").attachInitialized(oEvent => {
const oInnerControl = oEvent.getSource().getAllFilterItems().find(oItem => oItem.getName() === "Name").getControl();
oInnerControl.setShowSuggestion(false);
delete oInnerControl.mEventRegistry["suggest"];
});
Just keep in mind that this is a very "smelly" solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try to use a custom search field as input field with suggestion.
You will find an example:
https://sapui5.hana.ondemand.com/#/entity/sap.m.Input/sample/sap.m.sample.InputSuggestionsCustomFilt...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.