cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 ValueHelp Table Title

rlachemann
Explorer
0 Kudos

Hi Experts,

I'm using SAPUI5 Fiori List Reports based on List Report Templates and CDS with ValueHelps via CDS Annotation.

My requirement is to change the ValueHelp Table Title from SAP standard "Items" to something meaningful.

I managed to set the Title to "Periods", but the counter does not work (should be "Periods (123)").

ValueHelp before with Table Title "Items":

ValueHelp after with Table Title "Periods":

Code:

onInitSmartFilterBarExtension: function (oEvent) {     
    var oSmartFilterBar = oEvent.getSource();
    oSmartFilterBar.getControlByKey("YourFilterName").attachValueHelpRequest(this.onValueHelpRequest, this);        
},


onValueHelpRequest: function() {
    if (sap.ui.comp.valuehelpdialog.ValueHelpDialog.prototype.test == null) {   //second time sets test=fntest2 which causes a loop
      sap.ui.comp.valuehelpdialog.ValueHelpDialog.prototype.test = sap.ui.comp.valuehelpdialog.ValueHelpDialog.prototype.onAfterRendering;
    }
    var fntest = function(oEvent){
		 this.test();            //call original onAfterRendering
		 var vId = this.getId();
		 if (vId.includes("YourFilterName")) {
		   var oId = sap.ui.getCore().byId(vId);
		   if (oId) {
			oId._sTableTitleNoCount = "Periods";
			oId._sTableTitle1 = "Periods ({0})";
		   }
	      }
	  }
    };
    sap.ui.comp.valuehelpdialog.ValueHelpDialog.prototype.onAfterRendering = fntest; 
},

Accepted Solutions (0)

Answers (1)

Answers (1)

ThorstenHoefer
Active Contributor
0 Kudos

Hello rlachemann,

I haven't tried this, but maybe this code will help. You can get the instance of the internal table. If you attach the updateFinished event, you can determine the number of items.

_oVlaueHelpDialog.getTableAsync().then(function(oTable){ oTable.setHeaderText('Period);})

Best Regards

Thorsten