Reputation: 342
I am using the UploadCollection control with instantUpload = true in SAPUI5.
UploadCollection control having uploadUrl Property, But I don't want to give this URL in XML view.
I would like to give this URL by using **setUploadUrl(sUploadUrl)**
method of UploadCollection control from Controller.js.
Now My question is i don't have upload button because I am using instantUpload
. then in which event I can write the following for setting upload URL
var oFileUploader = sap.ui.getCore().byId("UploadCollection");
var sUrl = "some URL";
oFileUploader.setUploadUrl(sUrl);
The following code is for UploadCollectionItem in xml view.
<UploadCollectionItem
documentId="{documentId}"
fileName="{fileName}"
mimeType="{mimeType}"
thumbnailUrl="{thumbnailUrl}"
url="{url}"
enableEdit="false"
enableDelete="false"
visibleDelete="false"
visibleEdit="false"
attributes="{path : 'attributes', templateShareable : 'true'}"
statuses="{path : 'statuses', templateShareable : 'true'}"
selected="{selected}">
<attributes>
<ObjectAttribute
title="{title}"
text="{parts : ['text', 'type'], formatter : '.formatAttribute'}"
active="{active}"/>
</attributes>
<statuses>
<ObjectStatus
title="{title}"
text="{text}"
state="{state}"
icon="{icon}"
iconDensityAware="{iconDensityAware}"
textDirection="{textDirection}"/>
</statuses>
</UploadCollectionItem>
</items>
</UploadCollection>
How to fix this issue Please help me.
Upvotes: 0
Views: 3104
Reputation: 412
You should try onInit function of your controller. But if you are using routing ( and if you not, you should ), attach an event to pattern match:
onInit: function() {
this.getRouter().getRoute(/*your route name*/).attachPatternMatched(this._onObjectMatched, this);
},
_onObjectMatched: function(oEvent) {
var oFileUploader = sap.ui.getCore().byId("UploadCollection");
var sUrl = "some URL";
oFileUploader.setUploadUrl(sUrl);
}
Upvotes: 1