cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Ui5 Databinding question sap.m.table with helpdialog

dirk_wieczorek
Participant
0 Kudos

I have an sap.m.table based on a Json model.

One of the columns contains an input field where the user can assign a User Id.

Therefore the user should select die ID from a helpdialog where all existing id are listed.

My Problem lies at the selected item event from the helpdialog.

There i get the Id the user as selected but  i dont know how to assign the Id to the appropriate field in the table.

The event in the selection doesn't know the  inputfield which triggered the dialog.

Is there a way?

items : {

path : "/ActionItems/",

template : new sap.m.ColumnListItem({

wrapping : true,

textAlign : sap.ui.core.TextAlign.Begin,

type : "Active",

cells : [

new sap.m.Input( type : sap.m.InputType.Text,

            maxLength : 100,

                   editable : true,

value : "{/RaisedBy}",

change : function(oEvent) {

path = oEvent.getSource().getBindingContext().sPath + "/UpdateFlag";

oEvent.getSource().getModel().setProperty(path, "true");

},

valueHelpOnly : true,

showValueHelp : true,

valueHelpRequest : function(oEvent) { }

  }   oValueHelpDialog.bindAggregation("items", "/FindUsersB1",   oItemTemplate);

   // attach close listener

oValueHelpDialog.attachConfirm(function (oEvent) {

var selectedItem = oEvent.getParameter("selectedItem");

if (selectedItem) {

  });

   // attach cancel listener

oValueHelpDialog.open();

Regards.

Dirk

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You have to store the current input reference into a javascript variable before calling the value help dialog.

valueHelpRequest : function(oControlEvent)

{

     this.oCurrentInput = oControlEvent.getSource();

        oValueHelpDialog.attachConfirm(function (oEvent) {

      var selectedItem = oEvent.getParameter("selectedItem");

      if (selectedItem) {

              this.oCurrentInput.setValue(selectedItem.userId);

     })

}.bind(this);

}

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Dirk,

Will this sample help? Plunker

Regards,

Sai Vellanki.