reorder ajax uploads

jbadiag

Member
Hi, Is it possible to allow to reorder ajax uploaded images?
I have a list of uploaded images and I want to allow to reorder them
Thanks in advance
 

Attachments

  • Captura de pantalla 2015-11-16 a les 18.24.39.png
    Captura de pantalla 2015-11-16 a les 18.24.39.png
    65.8 KB · Views: 131
Not really. They are added on the fly in the fileupload.js. You might possibly be able to do it in Javascript, using a form_X.js with some code wrapped in that requirejs() I gave an example of in your last thread, but that would get kind of messy.

What ordering do you need? Alphanumeric on the file names?

-- hugh
 
To give you a fighting chance, in this commit:

https://github.com/Fabrik/fabrik/commit/33e1dbe4b65b68eed8987bd56c9417feb24918a9

... I've added an event that fires before we render the plupload widget. This would give you a chance to sort the object that contains the file names.

Code:
requirejs('[fab/fabrik]', function() {
   Fabrik.addEvent('fabrik.fileupload.plupload.build.start', function(el)  {
      // the files are in el.options.files, which is an object of objects you need to sort by the name property 
   });
});

However, sorting objects in JavaScript is not trivial, although Stack Overflow has a number of good q/a's on the subject.

-- hugh
 
Sorry, I know that I'm stupid. I have downloaded from github your js but I can't see any change
Everything it's still the same. What do I have to do? I'm not great with javascript...
is it possible to order manually, like drag and drop?
 
Last edited:
If your Javascript chops aren't very good, the change I made probably won't help ... as I said, ordering objects of objects is non trivial in git. I really only did it so I could have a quick go at some custom JS to do it, but even I gave up after about 20 minutes.

No, there is no support for drag and drop, that would be even more work.

The only way to realistically do this would be for us to add YAFO (Yet Another Option) to the upload element, letting you specify whether you want to order AJAX uploads chronologically or by file name, and to do it in PHP when querying the table. Which isn't something we can do as part of subscription support, it would need to be a custom job.

-- hugh
 
Yup, I'm familiar with a variety of "sortable" plugins, but like I said ... it's still a lot of work. And unless you want to re-sort every time you load the page ... it doesn't really help much, as we have no concept of a sort key in the uploads. In order to be "sticky" we'd have to save the sort order with the form, add fa field to the repeat table we store the upload data in, etc. which is again a lot of work.

It'd probably be about $50 or so to add an option that would let you specify either chronological or file name order.

-- hugh
 
It's not a problem for the $50, But I need to sort images using drag and drop, doesn't matter if using YAFO ;)
There's a related table called 'mq_habitatges_7_repeat_repeat_imagen' and other called mq_habitatges_7_repeat.
Is there any way to add a field called "sort" where store a sort order, so I / you can add an applet like http://demos.codexworld.com/dragdrop-image-reorder/
and use drag and drop to reorder? Because if I sort by filename or chronological then I can't use drag and drop to store in "sort" field, isn't it?
I can point to you to my website
 
Nope, drag and drop isn't going to happen. That would be more like a day or more's work, in the $500 range, and I'm not even sure it's something I want to add to the core code - it would mean a lot of changes to existing code, including having to add extra columns to those repeat tables on the fly for sites that have existing upload elements that don't have them, plus a lot of other tough code. Which is a lot of extra maintenance and potential for support hassles going forward.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top