Skip to Content
1

SmartField not working in FIORI

Feb 02 at 11:41 PM

71

avatar image

Hello,

I created an app using FIORI elements with the following steps:

1. Created CDS view

2. Published ODATA service

3. Used the service to create a List Report

4. Used extensions to create a List Report action

5. Added the code to display a pop up with input field which has a search help.

Problem:

The pop up displays the input field like a label or the input field is not getting displayed.

	var oModel = this.getView().getModel();
		var oForm = new sap.ui.layout.form.SimpleForm({
			editable: true
		});

		var sParameterLabel = "Employee";
		var sBinding = "{emp}";
		debugger;
		var oField = new sap.ui.comp.smartfield.SmartField({
			value: sBinding
		});
		var sLabel = new sap.ui.comp.smartfield.SmartLabel();
		sLabel.setText(sParameterLabel);
		sLabel.setLabelFor(oField);
		oForm.addContent(sLabel);
		oForm.addContent(oField);

		var oParameterDialog = new sap.m.Dialog({
			title: "Assign New Employee",
			content: [oForm],
			beginButton: new sap.m.Button({
				text: "OK",
				press: function() {
				}
			}),
			endButton: new sap.m.Button({
				text: "Cancel",
				press: function() {
					oParameterDialog.close();
				}
			}),
			afterClose: function() {
				oParameterDialog.destroy();
			}
		});

		oParameterDialog.setModel(oModel);
		oParameterDialog.open();

What is going wrong ?

Thanks,

Kabir

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Kabir Siddarth Feb 05 at 09:01 PM
1

Hi Pratheek,

Thanks for the response. I set this annotation in my CDS view and it began to work.

@ObjectModel.updateEnabled: true

Regards,

Kabir

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member
Feb 04 at 02:55 PM
0

Hi Kabir,

Did you try setting "contextEditable" property of SmartField? This should solve the problem.

And Just for your Information,

Along with your model, Fiori Elements also creates a Model at Runtime named "UI" set to the View and Component. This Model has a property called "editable" which can be used by developers to set the editability of your extended controls.

contextEditable={ui>/editable} in short.

Regards,

Pratheek

Share
10 |10000 characters needed characters left characters exceeded