cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Multi combo box in smart filterbar

S0024670220
Explorer
0 Kudos

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.

maheshpalavalli
Active Contributor
0 Kudos

Is that a custom filed or a normal field which is coming from annotations?

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

S0024670220
Explorer
0 Kudos

hi Mahesh Kumar Palavalli

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}]};

S0024670220
Explorer
0 Kudos

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>