问题
I found a bit of code to import CSV files. It uses a file upload control to get a handle to the file. It works great when I just use it on a regular xPage.
But I want to use it within an extensions pages dialog box but it does not work. The line causing the issue is this line?
var fileData:com.ibm.xsp.http.UploadedFile = facesContext.getExternalContext().getRequest().getParameterMap().get(getClientId('fileUpload1'));
It always returns null. I indeed have a control on my dialog box called fileIpload1.
The difference I am seeing in the client ID is that on the straight xPage, the client id is: view:_id1:_id19:fileUpload1 and when a dialog box is used the client id is: view:_id1:_id193:_id194:_id195:dlg_ImportParticipants:_content:form1:_id373:fileUpload1
Any idea what I am doing wrong if anything or a work around?
回答1:
The answer to this question can help you: Ext lib dialog and file upload controls
In short: you need to use a workaround.
I use it and therefore have working code available if you need some more help.
回答2:
Thanks for that link Per. I think maybe a bit complex for me right now. I came up with my own solution (sort of). What I do is to place a panel on my main xpage with the file upload control. My button unhides the panel. My Import button imports the code but also hides it again. The issue I still have is that I am still having is updating an "embedded" view on the xpage after the import executes.
BTW I am hiding / unhiding the panel using the CSS display property.
This is not nearly as elegant as in the link that you posted but far more simple.
来源:https://stackoverflow.com/questions/14204216/null-value-for-filedatacom-ibm-xsp-http-uploadedfile-in-dialog-box