cancel
Showing results for 
Search instead for 
Did you mean: 

getting values in multiinput from value help

Former Member
0 Kudos

Hi All,

view :

<MultiInput showValueHelp="true" id="multiInput1" valueHelpRequest="handleValueHelp" width="180px"/>

init();

this.theTokenInput= this.getView().byId("multiInput1");

this.aKeys= ["AssetNumber", "AssetClass"];

this.aTokens= [];

this.theTokenInput.setTokens(this.aTokens);

handleValueHelp: function() {

  this.aItems = [{

  AssetNumber: "F-10001",

  AssetClass: "F-10001",

  CompanyCode: "0001 (SAP France)",

  Description: ""

  }, {

  AssetNumber: "F-10001-1",

  AssetClass: "F-10001-1",

  CompanyCode: "0001 (SAP France)",

  Description: "Construction"

  }, {

  AssetNumber: "X-0001.01.03",

  AssetClass: "X-0001.01.03",

  CompanyCode: "0001 (SAP France)",

  Description: "Design"

  }, {

  AssetNumber: "X-0001.01.04",

  AssetClass: "X-0001.01.04",

  CompanyCode: "0001 (SAP France)",

  Description: "Requirement"

  }, {

  AssetNumber: "X-0003.01.05",

  AssetClass: "X-0003.01.05",

  CompanyCode: "0001 (SAP France)",

  Description: "WBSE for Simple Finance"

  }];

  var that = this;

  var oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog({

  basicSearchText: this.theTokenInput.getValue(),

  title: "Assets",

  supportRanges: true,

  supportRangesOnly: false,

  supportMultiselect: true,

  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: "Asset Number",

  template: "AssetNumber"

  }, {

  label: "Asset Class",

  template: "AssetClass"

  }, {

  label: "Company Code",

  template: "CompanyCode"

  }, {

  label: "Description",

  template: "Description"

  }]

  });

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

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

  oRowsModel.setData(this.aItems);

  oValueHelpDialog.getTable().setModel(oRowsModel);

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

  oValueHelpDialog.setTokens(this.theTokenInput.getTokens());

  var oFilterBar = new sap.ui.comp.filterbar.FilterBar({

  advancedMode: true,

  filterBarExpanded: false,

  filterGroupItems: [new sap.ui.comp.filterbar.FilterGroupItem({

  groupName: "gn1",

  name: "n1",

  label: "Asset Class",

  control: new sap.m.Input()

  }),

  new sap.ui.comp.filterbar.FilterGroupItem({

  groupName: "gn2",

  name: "n2",

  label: "Company Code",

  control: new sap.m.Input()

  }),

  new sap.ui.comp.filterbar.FilterGroupItem({

  groupName: "gn3",

  name: "n3",

  label: "Asset Number",

  control: new sap.m.Input()

  }),

  new sap.ui.comp.filterbar.FilterGroupItem({

  groupName: "gn4",

  name: "n4",

  label: "Description",

  control: new sap.m.Input()

  }),

  new sap.ui.comp.filterbar.FilterGroupItem({

  groupName: "gn5",

  name: "n5",

  label: "Cost Center",

  control: new sap.m.Input()

  })

  ],

  search: function() {

  sap.m.MessageToast.show("Search pressed '" + arguments[0].mParameters.selectionSet[0].getValue() + "''");

  }

  });

  if (oFilterBar.setBasicSearch) {

  oFilterBar.setBasicSearch(new sap.m.SearchField({

  showSearchButton: false,

  placeholder: "Search"

  }));

  }

  oValueHelpDialog.setFilterBar(oFilterBar);

  oValueHelpDialog.open();

  oValueHelpDialog.update();

  oValueHelpDialog.addStyleClass("sapUiSizeCozy");

  }

I have this code.

will share screen shots:

I have a multiinput as

and a value help pops out :

As I check the check boxes and click on Ok.The values checked should come in multiInput.

Please guide me .

Tell me where my coding is getting wrong.



Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Karan,

Did you check this explored sample?: SAPUI5 Explored

Regards,

Sai Vellanki.

Former Member
0 Kudos

Hi Sai,

I have used the same code.

Just few modifications .

Have a look n let me know where i m getting wrong.

Former Member
0 Kudos

Sai ??

saivellanki
Active Contributor
0 Kudos

Hi Karan,

Increase your MultiInput control width. Then you can see the values, sample: Plunker (I used your code).

Regards,

Sai Vellanki.

Former Member
0 Kudos

Hi Sai,

Something is really weird.Both codes are same still I m unable to get tokens.

that.aTokens = oControlEvent.getParameters("tokens");

when i debug this. aTokens is undefined.

Iseriously dont know wats happening.

saivellanki
Active Contributor
0 Kudos

Karan,

Re-check the code whatever you are trying?


Regards,

Sai Vellanki.

Former Member
0 Kudos

Hi Sai,

I have panel which generates panels due to cutomList. In that panel I have that field of value help. The example you help me with cutomList. So due to list Id of the field is generating dynamically.So when I getting view by Id "MultiInput1". Its not getting the view.

Please help me getting dynamic Id

Thanks

Waiting fr ur Reply

Former Member
0 Kudos

Sai??

saivellanki
Active Contributor
0 Kudos

Hi Karan,

On your value help request event in controller, try something like this:


onValueHelp : function(oEvent){

var oSelectedMultiInput = oEvent.getSource();

var oSelectedMultiInputID = oSelectedMultiInput.getId();

}

Regards,

Sai Vellanki.

Former Member
0 Kudos

THANKS SAI !!!!!

ITS WORKING

Answers (0)