on 04-04-2019 3:49 AM
Hi experts,
I have a list report application with ui annotations.
In that one of the selection fields is multi combo box(fixed value list annotation).
Issue is, I want to set default value for the combo box when the page is loaded & the default value is available with URL. When I set the value for combo box on attachInitialise(or attachInitialized) events, I could see the value being populated. But it is not passed in odata call when go is pressed.
Code in attachInitialise(this gets called from onInit of the controller extension):
this.filterid.attachInitialise: function (){
var filterid = this.filterid;
this.filterid.setFilterdata("data from URL as JSON format");
this.filterid.getControlByKey("filtername").setSelectedKeys("data from URL as string");
}
Kindly suggest is there anyway I can pass the default value on go button.
Hi Sakthi kumar,
I am not sure about the best practice here, but we can do like below:
this.getView().byId("listReportFilter").attachInitialized(function () {
var mFilterData = this.getView().byId("listReportFilter").getFilterData();
mFilterData["overallstatus"] = { // here your value help field
"items": [{
key: "P" // Pass the key here
}]
};
this.getView().byId("listReportFilter").setFilterData(mFilterData);
}.bind(this));
You can also create a variant and set it as a default one for all other users right? did you try that option?
BR,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks.This resolved the issue. I was setting the filterdata value directly earlier.
Instead I am setting as u said in items aggregation
mFilterData["overallstatus"] = { // here your value help field"items": [{key:"P" // Pass the key here}]};
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mahesh,
That is a normal field with below attributes in
metadata.xml:
<Property Name="ABC" Type="Edm.String" Nullable="false" MaxLength="25" sap:label="ABC" sap:filterable="true"
sap:updatable="false" sap:creatable="false" sap:sortable="false" sap:value-list="fixed-values"/>
annotations.xml:
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="CollectionPath" String="ABCInputHelpSet" />
<PropertyValue Property="Parameters">
<Collection><Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="ABC" />
<PropertyValue Property="ValueListProperty" String="ABC" />
</Record></Collection></PropertyValue></Record></Annotation>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.