order list plugin

skyrun

Active Member
i have a list that has a repeat group in it. i'm trying to order the elements within the repeat group using the order plugin.

i added a field element called 'order' in the repeat group (and verified it's in the _xx_repeat table) and set the plugin to order the main list by that field (there is no list on the repeat table). and i can drag and drop to reorder also! however when i press 'refresh' the elements are back where they were before in the default order.

can i use the order list plugin to order the elements within the group?

example: http://testlocation.skyrun.com/skytrax-manage/lookup-tables/amenity-setup
 
I had a look at the code, and ran some tests, and it was simply never written with being able to use repeat elements in mind. It would be seriously major surgery to fix, as it's all keyed off the main rowid, which of course is the same for each "parent" row. So if you have (say) 6 repeats on 6 rows, the "rowid" is the same. And all the math and SQL magic to bump the ordering up and down for all rows in the appropriate direction is hard coded for just the primary table.

-- hugh
 
thanks hugh,
for those reading this in the future, i was able to find a workaround that worked for my use-case where i could use the order plugin to do order rows on both the primary and the joined table. and still use the order list plugin it as it was intended (to sort one primary table). this is probably obvious for fabrik gurus, but in case it's helpful for others:
  1. Define both tables as individual lists with a column where they can be joined. So define 'Bands' and 'Members' separately with members.band_id as a linking column. Do it this way instead of adding a repeating group to a primary table using fabrik where fabrik automatically creates a table for you named something like primary_table_22_repeat.)
  2. put a column 'order' on both lists and setup the order list plugin on both lists so that both can be sorted individually.
  3. on the form for your primary table (which shows when you click one of the items from the primary list) put this in the footer text:
    {fabrik view=list id=xx joined_table___parent_id={primary_table___id}}
    where xx = the fabrik id of your joined table.
    or using the example of bands with members, {fabrik view=list id=xx Members___band_id={Bands___id}} where xx = the fabrik id of the Members list.
    This will display the list of members for the band under the band info when that band is selected AND that list of members will be able to be ordered too within the Band.
Then you can order the primary table, and you can click on items on the primary table and then be able to sort the items in the joined table too.

Doing it that way also gets around the confusion of doing it all on one grouped list. like what happens when you drag members from one band to another band on the list (like that creates confusion in real life too).
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top