I am trying to do excel download where user can give name for the file before download.

  1. I have a file name dialog (FileDialog), which is modal
  2. From download button (icon top right) shows modal dialog (calls: ShowAndHideFileDialog) > Ajax Submit
  3. Close -button closes window (calls: ShowAndHideFileDialog) > Ajax Submit

PROBLEM: 

  • Save -button starts file download for the browser, but does not close the modal (ToggleModal does not work)
  • You cannot use Ajax Submit, because you get error 


Question: Any idea how to make download and close modal window in same flow?


Solution

Hi Jukka,

I made sample oml based on your condition.

Use demo from here Download And close model


1.You need to use extra button to download file.

2. on save button use ajax button an call widget for download button.


regards

Rahul Sahu

Solution

Rahul Sahu wrote:

Hi Jukka,

I made sample oml based on your condition.

Use demo from here Download And close model


1.You need to use extra button to download file.

2. on save button use ajax button an call widget for download button.


regards

Rahul Sahu

Thanks Rahul. 

This works, but it looks so "dirty workaround" that I would like to understand why this is done so hard or is there better way to do it? 

Hided button does not look nice. It is like those "extra empty pixel pictures", which was need to get Netscape and IE layouts look same (90's stuff)


BR,

JP



Hi Jukka, 

yes i know but i dont think so there is other way we can do, because i tried another way but it is not working.

and this button is not show on UI mena browser also you can put link as blank and it is also working same.


Regards

Rahul Sahu

Hi,

Thank you Rahul. This was very helpful.

I also noticed:

  • It has to be a button, which is pointed in Widget_Click. Link does not work. 
  • Button needs to be outside of modal.
  • If ToggleModal's TriggerButtonId is not pointing to Save-button, it only closes modal, but does not call Widget_Click after it.
  • Any changes done to Filename in SaveOnClick is missing, so e.g. file extension check needs to be done in DownloadOnClick (hided button call)

Here is how I did it.



Jukka Pekka Patrikainen wrote:

Hi,

Thank you Rahul. This was very helpful.

I also noticed:

  • It has to be a button, which is pointed in Widget_Click. Link does not work. 
  • Button needs to be outside of modal.
  • If ToggleModal's TriggerButtonId is not pointing to Save-button, it only closes modal, but does not call Widget_Click after it.
  • Any changes done to Filename in SaveOnClick is missing, so e.g. file extension check needs to be done in DownloadOnClick (hided button call)

Here is how I did it.



 

 Only one point check if file name is blank than add dummy file name .


Regards

Rahul