• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

re-ordering items in a repeating group

skyrun

Active Member
there are a few forums on this like http://fabrikar.com/forums/index.php?threads/how-to-order-the-records-inside-a-repeated-group.45472/

these tell you how you can order the items for display using order by on the list.

i would like to do the next level... i would like for an end-user to be able to order by drag and drop, items on a repeating group on the front-end. Much like you can on the back end for dropdown element types by dragging the grey 3-bar up and down on a repeating group.
View attachment 17266

my design is to add an item on the group->repeating tab for 'Order by' that would allow the selection of a column to order by. if no column is selected, then it works just like it does now. but if a column is selected, the template would order by that column (like adding it to order by on the list already does) but will also add the grey square to allow users to re-order the rows. *this is like the old order list plugin, but for repeating groups.

i would like to add this function to fabrik to make a small contribution to the product that has done so much for my business.

looking for any feedback/tips/design ideas on doing this and would also like to ask, 'anyone want a paid programming job?' to do this and contribute it on github if fabrik would like to add it to the core?
 
Hmmmm. That would be non trivial.

Mostly the javascript side of it. The repeat group code is ... brittle, and complex.

If anyone wants to tackle it, I could provide advise.

-- hugh
 
Must it be done in the form?

With the order list plugin (and an additional order element) you can drag/drop.

So if the form had a link to the filtered repeat group list the user could use this list ordering...
Maybe in a popup?
 
thanks hugh.
troester, yes, i think i would like to do it in a form vs. a list. it's on a tab in a larger form and i have some calc'ed items on it and most importantly, it's all info people can type in (so a form vs. a list).

the use-case is i think pretty standard... details on a customer invoice. so adding new lines for items and filling them in to complete the invoice.

you can see it here in action if you have a logon from the fabrik site: https://testlocation.skyrun.com/skytrax-manage/work-orders/form/52/219 (labor and materials tabs).

OR here is a screenshot:
View attachment 17267
as the form is filled in and new lines added and removed, the ext cost is calc'ed using fabrik's built-in ajax (cool). the final total at the bottom is displayed and also dynamically updated using a custom template.

so my add is to 'just' be able to drag and drop the items up and down on the list so that the invoice makes the most sense when printed for the customer if we add a new item that we would prefer to show higher on the list. of course i could just display the 'order' column on the repeat group and then let users type integers there (and sort them on a page load), but where's the fun in that? ;-)
 
speaking of brittle. i think there is possibly an error in how repeat groups are handled when displayed in tables.

here are some example use-cases:
  • when you add a new row (or rows) then refresh, the new row goes to the top after a refresh vs. the bottom.
  • when you delete a row it works to hide the correct one visually. however when you refresh the page, a seemingly random OTHER row has been deleted instead of the one you intended to delete.
both of these use-cases work fine when i change the group template to a 'list' vs. table. so i think something in the logic of lists needs to be applied to the table code (most likely .js if it's different for lists and tables).

you can see what i mean on https://testlocation.skyrun.com/skytrax-manage/work-orders/form/52/219
tab 3 is labor which is in a repeating group displayed in a list template currently (see screenshot) unless i'm messing with it... and tab 4 is in a repeating group displayed in the table template.

you'll quickly see bugs when adding and removing lines from the table one that don't happen on the list one.

i have just updated fabrik code to the latest and haven't started modifying anything yet for my ordering enhancement. i have modified the layout template, but only to add a total row on the bottom.

here is the group that you can experiment switching back and forth if you want. it's what's displayed on tab 3 (labor details):
View attachment 17268
 
ok, you're right, instead of 'refresh', i meant 'save' or apply. i think if you try adding a few rows and saving or removing a row or two and saving that you'll see what i mean. works fine on a 'list' repeating group. doesn't work on a 'table' repeating group.
 
NEVER MIND: i figured out the issue here is that i copied an OLDER version of the template. on bootstrap_tabs, repeat groups function well on both tables and lists formats. so i copied a fresh start and added my template mods from there.

so no more help needed on that aspect of this thread which i hajacked... sorry.

on the group ordering, i will still look into that as an enhancement. HOWEVER i did add an 'order' element and the user can type numbers in there and order the repeat group with a save. and that doesn't work too badly...
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top