我想从p:fileUpload中删除上传和取消按钮。对于上传按钮,我尝试了这样的css(在不同的变体中):
.ui-fileupload-upload button {
display: none;
}
但它仍然可见。
<button type="button"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left ui-state-disabled ui-fileupload-upload"
disabled="disabled">
<span
class="ui-button-icon-left ui-icon ui-c ui-icon-arrowreturnthick-1-n"></span>
<span class="ui-button-text ui-c">Upload</span>
</button>
我看到这个出版物[链接](how to remove upload cancel button from <p:fileUpload>)并再次尝试了不同的css,但我没有设法摆脱它。感谢。
答案 0 :(得分:4)
至少使用<p:fileUpload>
上的那些属性会让它们消失:
<p:fileUpload ... auto="true" showButtons="false" />
答案 1 :(得分:1)
试试这个:
.ui-fileupload-buttonbar .ui-fileupload-upload {
display: none;
}
.ui-fileupload-buttonbar .ui-fileupload-cancel {
display: none;
}
答案 2 :(得分:-2)
使用FileUploader
中的ng2-file-upload
和.html
中的<tr *ngFor="let item of uploader.queue let i = index">
<td>
<div *ngIf= "!uploader.queue[i].isUploaded">
<button type="button" class="btn btn-success btn-xs" style="margin:2px" (click)="onSubmit(i,item,$event.target)" >
<span class="glyphicon glyphicon-upload"></span> Upload
</button>
</div>
</td>
</tr>
:
component.ts
在 public index:number ;
public onFileSelected() {
this.uploader.queue[this.index].isUploaded=false; // initializing uploaded to false
}
public onSubmit(index:number){
this.uploadService.uploadFile(this.csvJsonData).subscribe((responseData)=>{
this.onSubmitresponse = responseData ;
if(this.onSubmitresponse.status==201){
this.uploader.queue[index].progress = 100;
this.toastrService.success('The File has been uploaded successfully !',this.onSubmitresponse.status,{positionClass:'toast-bottom-center'});
this.uploader.queue[index].isUploaded=true;// will hide the upload button
}
else this.toastrService.error(this.onSubmitresponse.errorMessage,this.onSubmitresponse.status,{positionClass:'toast-bottom-center'});
});
}
{{1}}