Change table order in drop down box

S

Steve Tilbury

Guest
Is there an "easy" way to change the order that tables appear in the drop down box selection? I've added a new table and would like it to appear in a sorted position in the list:. The only way I can see to do this is to uninstall, then reinstall the tables.

Currently:

1799_Portsmouth_Guide
1823_Pigots_Hampshire_Directory
1830_Pigots_Hampshire_Directory
1842_Pigots_Hampshire_Directory
1859_Whites_Hampshire_Directory
1873_Hampshire_Returns_Of_Owners_Of_Land
1914_Navy_List
1805_Navy_List

Ideally:

1799_Portsmouth_Guide
1805_Navy_List
1823_Pigots_Hampshire_Directory
1830_Pigots_Hampshire_Directory
1842_Pigots_Hampshire_Directory
1859_Whites_Hampshire_Directory
1873_Hampshire_Returns_Of_Owners_Of_Land
1914_Navy_List

 
D

Debbie Sontag

Guest
Hmmmmmmm...... Not sure what I can tell you here. In all the databases that I'm managing with Dadabik, the table names in the drop down are sorted first numerically, then alphabetically (names beginning with a cap then those beginning with small letters):

123_Tablename
123_tablename
234_Tablename
Tablename
tablename
tablename2

If I add another table (Tablename3) to the database and also to the Dadabik install, it inserts it in the proper order:

123_Tablename
123_tablename
234_Tablename
Tablename
Tablename3 <-- new table inserted
tablename
tablename2

I have not altered the script in any way to have this done. In one of my databases, I had to rename one table to begin with a cap so it would appear first in the list before all the lower case names.

Sorry I can't be more help, however, I'll check a little further and post if I come across something.
 
D

Debbie Sontag

Guest
UPDATE ...

Try changing the following line in business_logic.php (on or about line # 1387):

FROM:
$tables_names_ar = build_tables_names_array(1, 1);

TO:
$tables_names_ar = build_tables_names_array(0, 1);

What you are actually changing is the part between the brackets from (1, 1) to (0, 1).

On an installation in Windows, the 1,1 makes the list ordered by the order of when the tables were installed. Changing it to 0,1 seems to force it to order by actual table name.

Does this change work?
Debbie
 
S

Steve Tilbury

Guest
Debbie:

Changing line 1387 in business_logic.php:

FROM:
$tables_names_ar = build_tables_names_array(1, 1);

TO:
$tables_names_ar = build_tables_names_array(0, 1);

does fix the sort order of the table names in the drop down box to what I want.

Thanks again!
 
Top