navigation among related tables

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

navigation among related tables

Postby ststoddard » Thu Dec 06, 2007 3:07 pm

I am trying to make my app more user friendly and easier to navigate about in using urls.

Here is the situation. I have nested, related tables. I want a user to be able to enter any one of the tables and then easily go to related records in the other tables. e.g.

table1 -> tableB -> tablex
-> tabley
-> tablez

If a user looks at entries in tablex, I want to be able to go to the parent record in tableB -- or the grandparent in table1.

If I startout by entering table1 and descending down through related records, then I can make my way back by using:
$query =& $app->getQuery();
$x = $query['my_id_var'];

However, if one just goes straight into a child table, then I can't sort out how to get my hands on the variable values in a record to jump to another related table.

E.g. I want to put something in block__after_record_footer() that will reference values in the currently viewed record, permitting easy navigation to wherever. Yet the only thing I can get is the cursor value (i.e. $query['-cursor']). Using $query['my_id_var'] returns empty. And if I try:
function block__after_record_footer(&$record) {
...
$x = $record->val('my_id_val');

}

I just get an error.

???

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

Postby kurisusan » Fri Dec 07, 2007 6:11 am

I understood, that you have a tree like structure und want to be able to navigate back to the root of the tree?
In that case I'd suggest to make use of the 'bread crumbs' which are shown just below the table tabs.
You can provide your own bread crumbs using the getBreadCrumbs delegate method. In your case it might be sufficient however, to proivide the getParent delegate method. Therein you can query the database to find the parent of the current record and return that. Then the bread crumbs will show all the nodes on the way the current record can be reached from the root.
I'm currently to inplement exactly that but I'm having problems right now which will be the subject of a new thread...

Christian
kurisusan
 
Posts: 25
Joined: Sat Oct 27, 2007 2:40 am

Postby Jean » Fri Dec 07, 2007 7:14 am

Try use
Code: Select all
$_REQUEST
rather than
Code: Select all
$query
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby Jean » Fri Dec 07, 2007 7:15 am

I mean for $query['-cursor']
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby shannah » Fri Dec 07, 2007 7:45 am

There is a breadcrumbs example here
http://xataface.com/forum/viewtopic.php?t=4102#20624

Also in regards to your request var that is getting lost. As Jean mentioned above you could use the $_REQUEST array instead of the $query array. However the $query array should still be working.

One thing that is a bit of a convention in Dataface is to pass request vars with '-' preceeding the name. This indicates to dataface that the parameter should not be treated as a search parameter, but rather as extra instructions

e.g. index.php?-myparam=myvalue
This parameter will also be retained across requests when you click on links in the interface.

If you want to pass a parameter to your script but don't want it to be retained across subsequent requests you would use '--' to preced the parameter name:
e.g. index.php?--myparam=myvalue

Hope this helps a little.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Fri Dec 07, 2007 3:46 pm

The breadcrumbs bit did the trick. Cheers.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 24 guests

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