cancel
Showing results for 
Search instead for 
Did you mean: 

Setting header Content-Disposition to the model

former_member196942
Participant
0 Kudos

Hi All,

I want to display PDF in sap.m.PDFViewer control, for which i want to set the header of the model:

this.oModel.setHeaders({ "Content-Disposition": "inline" });

I bind this model to my fragment where my PDFViewer control is present.

However, in the network calls, i dont see the "Content-Disposition" header getting passed.

Also, when I make a call from controller, i see the "Content-Disposition" header getting passed in the Request headers.

I have also tried adding the header in the manifest.json under data source but nothing helps.

Where am i going wrong?

var oFileUploadConsentFragment = sap.ui.xmlfragment("myfragment", this);
this.getView().addDependent(oFileUploadConsentFragment);
	var sSrcPath = "myServiceURL" + "/Attachments('IdOfMyAttachment')/$value";
var oJsonData = {
				"Attachment": sSrcPath
			};
var oConsentManagementModel = new sap.ui.model.json.JSONModel();	oConsentManagementModel.setData(oJsonData);
this.oFileUploadConsentFragment.setModel(oConsentManagementModel, "oJsonModel");
this.getView().getModel().setHeaders({
				"Content-Disposition": "inline"
			});
this.oFileUploadConsentFragment.setModel(this.getView().getModel());



XML Fragment:
<PDFViewer source="{oJsonModel>/Attachment}"></PDFViewer>

Accepted Solutions (0)

Answers (0)