organizing many tables

A place for users and developers of the Xataface to discuss and receive support.

organizing many tables

Postby ststoddard » Thu Apr 03, 2008 2:25 pm

I realize that there is some risk that the way to deal with this situation is already dealt with in the docs or prior posts, but can't recall seeing anything that will specifically do what I want, so here goes:

In my database, I have 50+ tables and growing. So this creates a mess when I open dataface, because my hand cramps by the time I scroll all the way down to find the last table in the menu at left.

Is there a better (easy) way to deal with this and allow simpler navigation to tables?

Thanks!

Steve
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Tue Apr 08, 2008 8:04 am

Hi Steven,

You can hide the tables menu by adding setting the 'show_tables_menu' pref to 0.

e.g.

add the following to your conf.ini file:

Code: Select all
[_prefs]
    show_tables_menu=0


Then you can create your own pull-down menu in one of the blocks. If we wanted to create a pull-down menu in the left column we could add the following to the application delegate class:

Code: Select all
function block__before_left_column(){
    $app =& Dataface_Application::getInstance();
    $tables =& $app->_conf['_tables'];
    echo '<select>';
    foreach ( $tables as $name=>$label){
        echo '<option>'.$label.'</option>';
    }
    echo '</select>';
}


Or something along those lines.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Sly » Tue Aug 04, 2009 1:18 am

Hi,

sorry to use this old thread, but I'm trying to do the exact same thing, however at the application level (not specific to one table).

Where should I put this piece of code? I tried the "index.php" at the root of my application, but this doesn't work (I think I did not understand how to implement delegate class for the entire application, and not table specific)

Or maybe it is possible to create some groups to group some tables together, and get a "Group1", Group2", etc... in the left navigation menu, with a "+" sign to display the grouped tables. This would be very nice.

thanks
Sly
 
Posts: 7
Joined: Wed Aug 27, 2008 2:27 am
Location: Toulouse, France

Postby shannah » Tue Aug 04, 2009 9:09 am

For information on the application delegate class (a class to apply to entire app, not just one table) see http://xataface.com/wiki/Application_Delegate_Class
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Sly » Tue Aug 04, 2009 11:54 am

Thanks a lot Steve, this is what I was looking for.
Sly
 
Posts: 7
Joined: Wed Aug 27, 2008 2:27 am
Location: Toulouse, France

Postby Sly » Wed Aug 05, 2009 6:55 am

This works fine, however I have now 2 other problems: I put some javascript to reload the page when a table is selected in the drop down list

- When I'm usung the "function block__custom_javascripts()" routine, it seems that the function I define in an external *.js file is unknown (at least this is what Firebug says) when it gets executed in the block__before_left_column() function. Strange...
- When I echo the javascript function directly in the block__before_left_column() routine, then the function is known, but I don't succeed in getting any value (I have "undefined" in the javascript alert)

Here is the code I have in ApplicationDelegate.php:

Code: Select all
class conf_ApplicationDelegate {
   function block__before_left_column(){
   
   echo "<script type=\"text/javascript\">
      function tableLoad(y){
      alert(y.value);
   }
   </script>";
   
   
      $app =& Dataface_Application::getInstance();
      $tables =& $app->_conf['_tables'];
      echo '<select name="ddl" onChange="tableLoad(this.value)">';
      foreach ( $tables as $name=>$label){
         echo '<option value="'.$name.'">'.$label.'</option>';
      }
      echo '</select>';
   }

/*   function block__custom_javascripts(){
      echo '<script src="javascripts.js" type="text/javascript" language="javascript"></script>';
   }
*/   
}

Sly
 
Posts: 7
Joined: Wed Aug 27, 2008 2:27 am
Location: Toulouse, France

Postby shannah » Wed Aug 05, 2009 11:56 am

I notice that you are calling your function with parameter this.value, then your function is using y.value. Hence you are effectively alerting this.value.value which is usually undefined.

You probably just want to call your function as:
onchange="tableLoad(this)"

In addition, I'm not sure you can just get the value of a select list using a value attribute (correct me if I'm wrong). I usually get it like this:

this.options[this.selectedIndex].value

But please correct me if I'm wrong. This could be an old habit from the prehistoric days of crappy web browser javascript.

As for why it isn't recognizing your function when placed in the block__custom_javascripts() block, check the HTML output and make sure that it is outputting your javascript function. If it is then something is wrong with the javascript. If it isn't that means that something may be overriding your block definition - or it could be a bug.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Sly » Tue Aug 18, 2009 6:41 am

thanks Steve.
Changing tableLoad(this.value) to tableLoad(this) solved the problem.

Seems you indeed can get the value of the select with a value attribute :lol:
Sly
 
Posts: 7
Joined: Wed Aug 27, 2008 2:27 am
Location: Toulouse, France


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 8 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved