Hi pbötcher,
thank you very much for the code. Unfortunately it does not work (for me). Even when I enter
Code: Select all
reorder_child_tabs('tablename1','tablename2','tablename3');
directly into the console (after placing the first code in header-extras.php (of course, outside of php) the console simply tells me "undefined".
I appreciate your help very much.
Yes, indeed, simply sorting the tables in AG is an option - at the first glance. But it's not really an option:
The order in AG is fix and results in the same order of links in the homepage and menu and links on top of the detailsview and registers. All mashed up and the same. But this is too easy: For different users (for example because of permissions) this order has "holes". Also, for different users, different orders might be usefull.
Let's assume, I have 3 navigation groups 1, 2 and 3. in 1 I have tables A,B,C (in this oder), in 2 M,N,O and in 3 X,Y,Z. The groups will show up in this order with this order of tables.
But maybe in DV of 1 I want Z,X,N,A,O (in this order as children) ...this can not be done right now: Z before X, then another group (N) and then another group (A) before back to group 2.
I absolutely see no reason, why AG does not allow setting the order as we want it on table-level.
Now you may ask why the ... does some one want such a mixed order? Well: different usergroups have different tasks at hand. One works more on Z, the other more on A. This would be one reason.
When we have a backlink to the main table it get's confusing:
Let's say a box is the first table in the application, as it's the most important.
A table holds data for a box. Each box has an exatly 1 owner (field in table).
The box has also N-customers (child table customers_boxes). Mostly owners are (also) customers and for this reason they are held in one table "companies".
Now, when I want to see the "companies" table it has 2 children: boxes (all boxes where company X is customer) and owners (all boxes where company X is owner).
Right now it's impossible to switch the order of the children as the "boxes" is the first table in the project. If one is more interested in the "owner" part, it might be useful to have this child always first.
I understand, that asking for the option to reorder may sound strange, but I hope I made it a little more obvious, why I think this would be good enhancement of AG. If the order (for links above DV and child-pages) can be set in AG and still manipulated later by code it would be great. For this I think it should be possible to intercept the order in the hooks/tablename.php -> _init function. Why? Simply, because we can for example draw userspecific settings from the database and use those to order according to those before the page even reaches the browser.
Olaf