DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL and SQLite; also available for Wordpress.

Welcome! Log In Create A New Profile

Advanced

Default Sort Order in Dadabik 4.3

Posted by Simun 
Default Sort Order in Dadabik 4.3
December 31, 2010 07:01AM
Merry Xmas and Happy New Year All,thumbs upwinking smiley

I feel like this might be a stupid question, but I have heard it said that the only stupid questions are the ones that are not asked.

So, is there a simple way of setting the default search order for a table to one specific or specific multiple columns?

Examples might be :-

1) Last name then First name.
or
2) County then City.

I know that the Dadabik administrator can cause initial display to be in a specific single order on one field by appending single field sort order parameters in the address bar.

so

../index.php?table_name=mytable&function=search&records_per_page=500

would become

../index.php/?table_name=mytable&function=search&records_per_page=500 &where_clause=&page=0&order=city&order_type=ASC

to order them by a City field in ascending order.

However, this is not easily accessible as a method for me because I have the login process to go through first and the initial results for my single table are displayed automatically after that.

I also know that the person viewing can click a specific field title once or twice to sort the results by that field in Ascending and Descending orders respectively.

But either way described only works for a single field.

So there are two questions really.

  1. How to set a default search order to a single specific field?
  2. How to set a sort order based upon two fields if indeed this is possible?

Both cases involving a user login first of all.

Any help greatly appreciated.

Kind Regards,

Simon
Re: Default Sort Order in Dadabik 4.3
January 02, 2011 11:26AM
Simun Wrote:
-------------------------------------------------------
> Merry Xmas and Happy New Year All,thumbs upwinking smiley

Happy New Year to you too smiling smiley

> I feel like this might be a stupid question, but I
> have heard it said that the only stupid questions
> are the ones that are not asked.

Nice tip winking smiley

> So, is there a simple way of setting the default
> search order for a table to one specific or
> specific multiple columns?

A quick hack: in index.php you can see two times (one for "normal" tabes the other for "linked" table) this piece of code
if (!isset($order)){
I guess (no tested) that if you put there something like
if ($table_name === 'mytable') $order = 'myfield';
you can set a default order field. Just one, two fields required more code changes.

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Re: Default Sort Order in Dadabik 4.3
January 05, 2011 05:46AM
Many thanks for replying and for the pointer.

I will give it a try.
Re: Default Sort Order in Dadabik 4.3
January 08, 2011 07:44AM
I found 'quick and dirty' way utilising the information that you provided.

This implementation concerns a single table. So I was able to set the default search order to column 9 in both places.

if (!isset($order)){
    // get the first field present in the results form as order - simon changed this to the city column
    $count_temp = 8;

Many Thanks.
Re: Default Sort Order in Dadabik 4.3
January 08, 2011 01:22PM
good!

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Sorry, only registered users may post in this forum.

Click here to login