0

My requirement is to set a F4 value help to one of the columns in a table. I built the F4 help with a fragment and also succeeded to get the data in that view.

Now when I click and trying to set the value to the ID of the column, it throws me the error:

Uncaught TypeError: Cannot read property 'setValue' of undefined.

Build Table in controller using JS

this.oEditableTemplate = new sap.m.ColumnListItem({
  highlight: "{TimeData>highlight}",
  cells: [
    new sap.m.Input("input_assisted1", {
      // ...,
      showValueHelp: true,
      valueHelpRequest: [this.onSearch, this],
    }),
    // ...
  ]
});

Below is the callback function called while closing the F4 dialog box:

onValueHelpClose: function (oEvent) {
  var wbsElement = oSelectedItem.getBindingContext().getObject().WbsElement;
  this.inputId = oEvent.getSource().getId();
  this.byId(this.inputId).setValue(wbsElement); // <-- error
  // also tried: this.byId("Input_Assisted1") but same error.
},
Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
  • Is the element with the ID of `this.inputId` in the fragment? If yes try to change `this.byId(this.inputId)` with `sap.ui.getCore().byId(this.inputId)` – Lumpenstein Aug 24 '20 at 06:39
  • 1
    Does this answer your question? [How to Access Elements from XML Fragment by ID](https://stackoverflow.com/questions/39660161/how-to-access-elements-from-xml-fragment-by-id) – Boghyon Hoffmann Aug 24 '20 at 10:07
  • Dear Lumpensteiin, Still the same error :(. – Ranjith Rupireddy Aug 25 '20 at 11:18
  • It's difficult to debug from here without much code. Would be nice if you could add an [mcve](https://stackoverflow.com/help/minimal-reproducible-example) to the question so that other readers can reproduce the issue. – Boghyon Hoffmann Aug 26 '20 at 07:34
  • Dear Hoffmann,I solved this in a different way, as a workaround , I read the Index of the selected column by binding context of the Model during the selection of value help and assigning the selected value to the column by using the index value. Thank you again for all of you who looked into this. – Ranjith Rupireddy Aug 29 '20 at 11:33

0 Answers0