multiWidget onChange event returning empty group

Hi,

I’m using JavaScript to fetch group information and the files in a multiwidget. However during the onChange event the group object does not contain the files even though the files have been uploaded and I can see the group information in onUploadComplete event. What could be causing this?

image

Group info

image

I should also point out that I’m using the widget inside Boostrap Modal.

Thanks

Hi @pdm.molefe

Thanks for the question! The onChange event fires when a user clicks the “Add” button in the widget. The callback gets a group instance, and you need to use the files() method of the instance to get an array of file instances. A file instance is a promise, so you need to resolve it to get file information.

I think using the widget inside Bootstrap Modal shouldn’t lead to any issues.

Try this code snippet and let me know how it works.

multiWidget.onChange(function (group) {
  group.files().forEach(function (file) {
    file.done(function (info) {
      console.log(info); // fileInfo object
    });
  });
});

This is working. Thank You!

@pdm.molefe :raised_hands: