cancel
Showing results for 
Search instead for 
Did you mean: 

How to set field in smart filter bar to read only?

0 Kudos

Hi Team,

We need to display time zone for the time field in samrt filter bar in read only mode.

I have tried with backend annotation using field control.

But its not working. Kindly advice me.

Regards,

Ashwini.

View Entire Topic
0 Kudos

First in the xml, define the event initialized like so:

<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="myEntity" initialized="onFilterBarInitialized>

<smartFilterBar:controlConfiguration> <smartFilterBar:ControlConfiguration key="Bukrs" visibleInAdvancedArea="true" index="0" groupId="_BASIC" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>

</smartFilterBar:controlConfiguration>

</smartFilterBar:SmartFilterBar>

Then in the controller you just have to call the event:

onFilterBarInitialized: function (oEvent) {

var oSmartFilterBar = this.byId("smartFilterBar");

if (oSmartFilterBar.isInitialised()) {

oSmartFilterBar.getControlByKey("Bukrs").setEnabled(false);

}

And voila , the field will be read-only. You can also assign it tokens in the same event if you want prefilled values.