FilePicker.IO & Meteor (Multiple Widgets on a Page)

157 Views Asked by At

I am using FilePicker.IO with Meteor. I have it set up and working, but I have fun into an issue using multiple widgets on a page.

I have a table with rows of data. The data set is a bunch of users with name, photo, address, etc.

I'd like to include a "upload photo" button on EACH row, but since the widget is rendered by ID, I am limited to one per page. Wondering if there is a solution where I can have an upload widget on each row of the table.

Here is my code in my coffee file:

filepicker.setKey('askdjw&H*(Djkjew)')  #Not my key

Template.admin.rendered = () ->  
    filepicker.constructWidget $('#uploadPhoto')

HTML:

<td><input type="filepicker-dragdrop" id="uploadPhoto" class="{{_id}}"/></td>
1

There are 1 best solutions below

1
On

A couple of things :

  • if {{_id}} is a unique id it should be in the id attribute
  • it looks like you are just passing a jQuery selector into filepicker, what is stopping you from using $('.uploadPhoto') instead?

You can see a similar pattern here in my datatables implementation