cancel
Showing results for 
Search instead for 
Did you mean: 

How to use value help(F4 help) inside sapui5 table row in Dynamic binding/At Run time?

Jayakrishnan
Active Participant
0 Kudos

Hi All,

i am working on custom SAPUI5 application development. As per my application scenario i need to use sapui5 table and row creation at run time. Whenever user press the add button at the top of the table header, i need to bind the row with table.In each row it contains 3 input fields , one value help and one combo box.

i have a separate OData service for both value help and combo box to load the items.I am facing difficulties with id and while try to set the selected value on the input field after chose from value help.

How to do this, please share any link or samples.

Thank you,

Regards,

JK.

Accepted Solutions (0)

Answers (3)

Answers (3)

maheshpalavalli
Active Contributor

Its very difficult to understand the issue from the limited information that you have provided..

From what i understnad, you can persist the id in this.valueHelpId = 'ID of the element that you are showing f4 help' and then once the value is selected in the help, use that id and set the value to the binding or to the control, then clear that id.

BR,
Mahesh

Jayakrishnan
Active Participant
0 Kudos

Hi Mahesh,

Thanks for your reply. Please see the below image for more understanding.

maheshpalavalli
Active Contributor
0 Kudos

Hi Jayakrishnan Chandramohan

Ok.. Have you tried the approach that I've mentioned where you can set the input control id to this.valueHelpId

in the f4 help event handler, this.valueHelpId = oEvent.getSource().getId();

Now after the value is selected, use this.getView().byId(this.valueHelpId).setValue();

and then clear the this.valueHelpId.

BR,

Mahesh

Jayakrishnan
Active Participant
0 Kudos

Hi Mahesh,

Thanks for your reply. Please see the below image for more understanding.

and i added the handleValueHelp function like below on the table row .

then i added the handleclose event and handlesearch event separately. But when i debugging it on the browser, those search and close event is not getting called.

Thank you,

Regards,

JK.

maheshpalavalli
Active Contributor

Ideally it should work, just check if you have done similar to what was done in the below link:

https://ui5.sap.com/#/sample/sap.m.tutorial.walkthrough.17/code/webapp%2Fcontroller%2FHelloPanel.con...

*****EDIT*****

Oh I get it, it is due to using 'this' inside the valuehelprequest function, this will not have the view instance inside the function..

you need to pass var that = this; before the input box and use that instead of this inside the valuehelprquest function or bind this like below

valuehelprequest: function() { 
...
}.bind(this)

BR,

Mahesh

Jayakrishnan
Active Participant
0 Kudos

I made the changes. Now i get an another error, setvalue of Undefined.

wagonIpnut is undefined? 😞

Thank you,

regards,

JK

maheshpalavalli
Active Contributor
0 Kudos

Try this:

sap.ui.getCore().byId(sId)

Jayakrishnan
Active Participant
0 Kudos

Hey in the same row i have combo box too. i need to bind the combobox items also at runtime. i usually load the model by using the id . but in runtime i cannot keep single id as it throws duplicate id error . How to do that?

Thank you,

regards,

JK.

maheshpalavalli
Active Contributor
0 Kudos

Then you have to model your structure differently in this case, lets say, your item structure is like below;

{ 
id: 1,
name: test
}

Now add another dummy property to it:

{
id: 1,
name: test,
dropdown:[]
}

This can be done when you add the data, pass the dropdown property as well with data specific to it or set the dropdown data to the model when he changes any other value in that record.

Else you can also do one thing, there is combo box lazy loading, once the user clicks on the dropdown, you can load:

https://ui5.sap.com/#/sample/sap.m.sample.ComboBoxLazyLoading/code

BR,

Mahesh

Jayakrishnan
Active Participant
0 Kudos

OK Mahesh, I will try that.

Jayakrishnan
Active Participant
0 Kudos

i try in this way, but it shows error.

maheshpalavalli
Active Contributor
0 Kudos

Hi Jayakrishnan,

I would suggest you to do this using XML view for consistency.. I think you are using js code for this, better put all that code in xml view.. it will be easier to understand where the issue is coming from

And btw for load items function, use bind(this) at end of function

BR,

Mahesh

Jayakrishnan
Active Participant
0 Kudos

Hey got it, I also did the same,

sap.ui.getCore().byId(that.inputId).setValue(oSelectedItem.getTitle());

it is working. Thank you for your help.

regards,

JK.