on 04-18-2018 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.
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 |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.