cancel
Showing results for 
Search instead for 
Did you mean: 

How to DataBind oValueHelpDialog SAPUI5

kaan_ozdogan
Participant
0 Kudos

Hi Experts,

I wantto databind sapui5  oValueHelpDialog , I wantto databind from,

......./sap/opu/odata/sap/ZWEBDI_FIORI03_SRV/DiGoruntule?URUNTIPI='BD'&DINO='2120896'&REVNO='1'

here my controller,

var that= this;
var oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog({
basicSearchText: this.theTokenInput.getValue(),
title: "Karakter",
modal: true,
supportMultiselect: true,
supportRanges: true,
supportRangesOnly: false,
key: this.aKeys[0], 
descriptionKey: this.aKeys[1],

ok: function(oControlEvent) {
that.aTokens = oControlEvent.getParameter("tokens");
that.theTokenInput.setTokens(that.aTokens);
oValueHelpDialog.close();
},

cancel: function(oControlEvent) {
sap.m.MessageToast.show("Cancel pressed!");
oValueHelpDialog.close();
},

afterClose: function() {
oValueHelpDialog.destroy();
}
});

var oColModel = new sap.ui.model.json.JSONModel();
oColModel.setData({
cols: [
{label: "Karakter", template: "Karakter"},
{label: "Tanim", template: "Tanim"}
//  ,
//  {label: "City", template: "City"},
//  {label: "Currency Code", template: "CurrencyCode"}
]

});

oValueHelpDialog.getTable().setModel(oColModel, "columns");

var oRowsModel = new sap.ui.model.json.JSONModel();
oRowsModel.setData(this.aItems);
oValueHelpDialog.getTable().setModel(oRowsModel);
oValueHelpDialog.getTable().bindRows("/");

Accepted Solutions (1)

Accepted Solutions (1)

kaan_ozdogan
Participant
0 Kudos

I know these example  sapui5 explorer

I want to databind this table from url = ......./sap/opu/odata/sap/ZWEBDI_FIORI03_SRV/DiGoruntule?URUNTIPI='BD'&DINO='2120896'&REVNO='1'

Private_Member_15166
Active Contributor
0 Kudos

where is your aItems??

In that example aItems is basically the rows data and in your code you are getting it from Gateway. so according to me you don't need to write all these codes.

var oRowsModel = new sap.ui.model.json.JSONModel();

oRowsModel.setData(this.aItems);

oValueHelpDialog.getTable().setModel(oRowsModel);

oValueHelpDialog.getTable().bindRows("/");

Just write this line and use the proper path of your Gateway service.

Answers (2)

Answers (2)

Private_Member_15166
Active Contributor
0 Kudos

See this code.

SAPUI5 Explored

Preview:- SAPUI5 Explored

santhu_gowdaz
Active Contributor
0 Kudos

SAPUI5 Explored

here in search method you need to call oData and do valuehelp table binding,

oValueHelpDialog.setFilterBar(new sap.ui.comp.filterbar.FilterBar({

  advancedMode: true,

  filterItems: [new sap.ui.comp.filterbar.FilterItem({ name: "s1", control: new sap.m.Input()})],

  filterGroupItems: [new sap.ui.comp.filterbar.FilterGroupItem({ groupTitle: "foo", groupName: "gn1", name: "n1", label: "Company Code", control: new sap.m.Input()}),

  new sap.ui.comp.filterbar.FilterGroupItem({ groupTitle: "foo", groupName: "gn1", name: "n2", label: "Company Name", control: new sap.m.Input()}),

  new sap.ui.comp.filterbar.FilterGroupItem({ groupTitle: "foo", groupName: "gn1", name: "n3", label: "Currency Code", control: new sap.m.Input()})],

  search: function() {

  sap.m.MessageToast.show("Search pressed");

  }

  }));