cancel
Showing results for 
Search instead for 
Did you mean: 

ValueHelprequest Event is not working

poojarychetan
Explorer
0 Kudos

I have a input field where i am trying to insert the "ValueHelp" and the event to appear from fragment xml and js file.

The project is just copied from a working one , i have everything assigned only the namespace is changed , but the event for value help is not working and i dont see errors in console.

Attached is the code:

in

1. View.xml

<VBox class="sapUiTinyMarginEnd" >
<Label text="{i18n>GTIN}" class="lab1" />
<Input id="masterGTIN" type="Text" placeholder="{parts:['i18n>Global Trade Item', '/#ObjItem/Gtin/@sap:label'], formatter: 'jQuery.sap.formatMessage'}"showValueHelp="true" valueHelpRequest="mdtradereport.delegate.MasterFilterDelegate.handleValueHelpRequest">
</Input> </VBox>

2. In delegate\MasterFilterDelegate.js

 handleValueHelpRequest: function (oEvent) {

        this._valueHelpSource = oEvent.getSource();

        if (this._valueHelpSource.getName() === "Gtin") {

          this._valueHelpDialog = this.getDelegate("Gtin");

          this._valueHelpDialog.open(this._valueHelpSource);

        } else {

          var sFragment = this._valueHelpSource.data("fragment") ? this._valueHelpSource.data("fragment") : this._valueHelpSource.getName();

          this._valueHelpDialog = sap.ui.xmlfragment(

            "mdtradereport.fragment.shared.valueHelp." + sFragment, this);

          this.getView().addDependent(this._valueHelpDialog);

          this._valueHelpDialog.addStyleClass("sapUiSizeCompact");

          this._valueHelpDialog.open();

        }

      },

Also not sure if ""mdtradereport.fragment.shared.valueHelp." in MasterFilterDelegate.js sholud be like that,(xmlfragment(

"mdtradereport.fragment.shared.valueHelp." + sFragment, this);

whereas the source where i copied which was working looks

===============================================

ar sFragment = this._valueHelpSource.data("fragment") ? this._valueHelpSource.data("fragment") : this._valueHelpSource.getName();
this._valueHelpDialog = sap.ui.xmlfragment(
"com.sap.cd.sttp.cockpit.fragment.shared.valueHelp." + sFragment, this);
this.getView().addDependent(this._valueHelpDialog);

==============================================


Can you get me some light on this what is wrong here ?

Accepted Solutions (0)

Answers (1)

Answers (1)

CristianBabei
Contributor
0 Kudos

Hello,

Dunno why you are using the full path,

 valueHelpRequest="mdtradereport.delegate.MasterFilterDelegate.handleValueHelpRequest"

You can just use the function name, this example works fine:

View:

<Input showValueHelp="true" valueHelpOnly="true" valueHelpRequest="onValueHelpEqunr"/>

Controller:

onValueHelpEqunr: function(oEvent) {
	if (!oFragmentEqunrSH || oFragmentEqunrSH.bIsDestroyed) {
		oFragmentEqunrSH = sap.ui.xmlfragment("...../view/Fragments/EqunrSH", oMainView.getController());
		oMainView.addDependent(oFragmentEqunrSH);
		oFragmentEqunrSH.addStyleClass(oMainView.getController().getOwnerComponent().getContentDensityClass());
	}
	oFragmentEqunrSH.open();
},