on ‎2018 Apr 18 10:29 AM
I have the following scenario:
A form binded to an entityset, I'm using annotations and have some smartFields.
The fields have their valueHelp binded to an getEntity. The thing is that I need to pass some custom filters to my smartField after they fill some of the inputs, like when you filter a list :
var oFilter = new Filter({ path: "...", operator: FilterOperator.EQ, value1: '....'});
var oBindings = sap.ui.getCore().byId(".......").getBinding("items");
oBindings.filter([oFilter]);
This is how I bind my form:
sap.ui.getCore().byId("form").bindElement("/TestSet('00')");
And my view:
<smartField:SmartField id="iSelectMotivo" value="{MotivoCrm}">
<smartField:configuration>
<smartField:Configuration controlType="input" displayBehaviour="idAndDescription"/>
</smartField:configuration>
</smartField:SmartField>
Any tips how can I archive this?
(Similar question https://answers.sap.com/questions/32849/pass-filter-to-value-help-of-smartfield.html
none answerd, 1 year ago)
Thx in advance.
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Solved it.
Seems, all Smart Objects, have inside the proper component it uses, so for example in a SmartField type Select, it has a sap.m.select inside, and when you access this one, is the same as for all other components, get the binding context and then filter.
_onCategoryChange: function(oEvent){
var vValue = oEvent.getSource().getValue();
var oFilter = new sap.ui.model.Filter({
path: "Test",
operator: sap.ui.model.FilterOperator.EQ,
value1: vValue
});
//var oSubcategory = sap.ui.getCore().byId('SFIESubcategory'); //This is the SmartField
var oSubcategoryList = sap.ui.getCore().byId("SFIESubcategory").getContent();
var oBinding = oSubcategoryList.getBinding("items");
oBinding.filter[oFilter];
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.