2

I'm just getting integrated with filepicker.io, and I'm using the very first example they provide with a drag-drop widget.

<input type="filepicker-dragdrop"/>

If already present in the html when the page loads, the custom input converts correctly. However if you add one to the page dynamically later, all you get is a featureless default input:

// Inserts generic featureless text input
$('#some_div').html('<input type="filepicker-dragdrop"/>');

Is there a way to force filepicker to reprocess the DOM and convert newly inserted widgets?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
cilphex
  • 6,006
  • 6
  • 34
  • 44

1 Answers1

9

You'll want to use the constructWidget call on the dom element when it's created and inserted into the DOM. See https://developers.filepicker.io/docs/web/#widgets-programming

brettcvz
  • 2,371
  • 1
  • 13
  • 14
  • How does one setup the OnSuccess callback when initializing via this method? – cman77 Dec 12 '12 at 13:38
  • You'll likely want the onchange event handler, which can be set at any time, before or after the constructWidget call. – brettcvz Dec 12 '12 at 18:45