Can I render & use a "filepicker" inside the response of an Ajax call??

Can I render & use a "filepicker" inside the response of an Ajax call??

av Daniel Gonzalez Lareo -
Antal svar: 2

Hi people!!

I've problems to show a filepicker in a form that is processed as a Ajax response.

When you load the page a js function, print_experiment(), is called. The response of this function depends of sevaral parameters. And one of the cases is a moodle_quickform that maybe contains a filepicker. All the other form elements works correctly but the filepicker stay blocked (with the loading circle). I know that filepicker uses a lot of Ajax. But there is a solution to use it in that way??

Someone can explain me (or point me the correct way) how can I solve this ??

 

Thanks a lot!!

 

PD: The version of moodle that I'm working with is 2.3

Genomsnitt av betyg: -
Som svar till Daniel Gonzalez Lareo

Re: Can I render & use a "filepicker" inside the response of an Ajax call??

av Tim Hunt -
Bild på Core developers Bild på Documentation writers Bild på Particularly helpful Moodlers Bild på Peer reviewers Bild på Plugin developers

ForumNG does this. Well, it achieves this effect: https://github.com/moodleou/moodle-mod_forumng/ Sorry, I don't know which the key bits of code are.

Som svar till Tim Hunt

Re: Can I render & use a "filepicker" inside the response of an Ajax call??

av sam marshall -
Bild på Core developers Bild på Peer reviewers Bild på Plugin developers

In summary, this is a nightmare.

In slightly less summary, if you create the necessary html as normal, then you will need to manually call the javascript init function that usually gets called for filepicker. ForumNG does it by having a 'template' of what the html/script should be then replacing certain variables in that template with the itemid, context or whatever it has in there (I forget).

--sam