cancel
Showing results for 
Search instead for 
Did you mean: 

Value Help Dialog: Rows are not shown as selected, even if tokens are set in Value Help Dialog

prakashsaurav
Active Participant
1,680

Hello All,

There are 2 similar issues.

1) In MultiInput, I set Tokens and Open the Value Help Dialog. I can see the tokens are properly set on value help dialog, but rows are not shown as selected.

2) I open Value Help Dialog, then select rows from inital list. Then I perform search on the value help. Rows selected are gone or not shown. But still previously selected tokens can be seen in the Value Help Dialog.

I have used the code as per sample form SAPUI5, I am unable to see any difference other that I am binding the OData model and Sample is binding the JSON Model.

SAPUI5 Version is 1.71.21

Any help is highly appreciated. Please let me know if you need more information from my side.

prakashsaurav
Active Participant
0 Kudos

Allow me some time, I will check and get back. Thanks for the reply.

MioYasutake
Active Contributor

Hi Prakash,

I posted a comment on below question, which may be relevant to you.

https://answers.sap.com/questions/12894789/to-retain-selection-history-in-valuehelpdialog.html

prakashsaurav
Active Participant
0 Kudos

mio.fujita So as of now there is no workaround for this, as per your debugging. Can we convert OData model to Json Model and attach. Will that work?

Accepted Solutions (1)

Accepted Solutions (1)

sergey_muratov
Participant
prakashsaurav
Active Participant
0 Kudos

I am calling the Update as mentioned in the email. I will go through the code once more and add it above for the reference. Thanks for the reply.

sergey_muratov
Participant
0 Kudos

You need to call this method strictly after the request of table data competed.Calling it after "open" method may be no result.

prakashsaurav
Active Participant
0 Kudos

Below is the position for the Update Call! Is it fine? Or I need to insert Update some place else.

// When Value Help is Requested
onSupplierHelpRequested: function() {
var aCols = this.oSupplierColModel.getData().cols;
this._oReferenceBasicSearchField = new SearchField({
	showSearchButton: false
});

this._oSupplierHelpDialog = sap.ui.xmlfragment("Reference.view.fragment.supplierHelp", this);
this.getView().addDependent(this._oSupplierHelpDialog);

this._oSupplierHelpDialog.setRangeKeyFields([{
	label: "Supplier",
	key:   "Supplier",
	type:  "string",
	typeInstance: new typeString({}, {
		maxLength: 7
	})
}]);

var oFilterBar = this._oSupplierHelpDialog.getFilterBar();
oFilterBar.setFilterBarExpanded(false);

this._oSupplierHelpDialog.getTableAsync().then(function (oTable) {
	oTable.setModel(this.oDefaultModel);
	oTable.setModel(this.oSupplierColModel, "columns");
	if (oTable.bindRows) {
		oTable.bindAggregation("rows", "/SupplierInfoSet");
	}


	if (oTable.bindItems) {
		oTable.bindAggregation("items", "/SupplierInfoSet", function () {
		return new ColumnListItem({
				cells: aCols.map(function (column) {
					return new Label({ text: "{" + column.template + "}" });
				})
			});
		});
	}
	this._oSupplierHelpDialog.update();
}.bind(this));

this._oSupplierHelpDialog.setTokens(this._oSupplierInput.getTokens());
this._oSupplierHelpDialog.open();
}

// When Search is Performed on Value Help
_filterTable: function (oFilter, oValueHelp) {
	var oValueHelpDialog = oValueHelp;

	oValueHelpDialog.getTableAsync().then(function (oTable) {
		if (oTable.bindRows) {
			oTable.getBinding("rows").filter(oFilter);
		}

		if (oTable.bindItems) {
			oTable.getBinding("items").filter(oFilter);
		}

		oValueHelpDialog.update();
	});
}


prakashsaurav
Active Participant
0 Kudos

sap.dev.sam Any feedback, do i need to add any calls or if you see any wrong sequence of calls

sergey_muratov
Participant

Hi

I didn't many experiments with this problem. As I understood a data request is triggered by open method. I didn't find events in ValueHelp control to track data request complete so I did it on model's level. I used code like this

this.getView().getModel().attachRequestCompleted(function (oEvent) {
					if (oEvent.getParameter("url").startsWith("<EntitySetId>")) {
						//console.log("requestCompletedForNotificationSet");
						this._oValueHelpDialog.update();
					}
				}.bind(this));
prakashsaurav
Active Participant

sap.dev.sam Great! 🙂 It worked like a charm. You are saviour. mioyasutake For your reference.

Answers (0)