open directory to detail view

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

open directory to detail view

Post by grimblefritz » 2016-07-11 23:26

Is there a way to have the menu panel or nav selection, open to the detail view instead of the table view? With the first record selected, that is acceptable.

Also, is it possible when a new record is added (for example, an order) and saved, to immediately go to the order_item table or detail view? That would simplify the order entry (or generally, the parent->child data entry) process.

There may be ways to do this, but I'm so far into the weeds on other projects, I just don't have the cycles to dig into this.

Thanks

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 356
Joined: 2013-03-21 04:37

Re: open directory to detail view

Post by peebee » 2016-07-12 00:12

Also, is it possible when a new record is added (for example, an order) and saved, to immediately go to the order_item table or detail view?
Built into AppGini. Select the desired table and apply redirection after insert.
screenshot.jpg
screenshot.jpg (100.15 KiB) Viewed 5344 times
For same result after Appgini Files are generated, you could edit this line in the concerned tablename_view.php

$x->RedirectAfterInsert = "your_desired_page.php";

Or as a hook:

RedirectAfter Insert is also a Datalist object: https://bigprof.com/appgini/help/advanc ... ist-object

So you should be able to include the redirection as a hook as per this example: https://bigprof.com/appgini/help/advanc ... ename_init

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: open directory to detail view

Post by grimblefritz » 2016-07-12 00:27

peebee, thanks for that. I'd missed the redirection in appgini. If that doesn't do what I want, then I'll try the hook.

Some parts of appgini I'm getting pretty familiar with, others are still unknown territory.

What about opening straight to the detail view, instead of table view - any ideas there?

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 356
Joined: 2013-03-21 04:37

Re: open directory to detail view

Post by peebee » 2016-07-12 01:25

URL "tablename_view.php?addNew_x=1" will take you directly to an "Add new" detail view which I imagine would be preferable to opening to the first/same record every time?

How to go about it would probably depend where you want to direct to the detail view from? Is this the home page links you are referring to or the dropdown navigation?

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: open directory to detail view

Post by grimblefritz » 2016-07-12 09:46

No, I actually want the first record. I have a setup table for the app. Only admin can insert/delete, one user in a Owner group can edit, and everyone else can only view. So, opening to the detail view is what I need.

I suppose I could hide the table from the home page and dropdown, then use a custom link to call it using ?SelectedID=1. That would work, but I'd prefer to keep the standard navigation.

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: open directory to detail view

Post by grimblefritz » 2016-07-12 09:51

Sometimes you just have to sleep on things and express them different.

The solution is terribly simple!

In hooks/tablename.php, function tablename_header(), switch case 'tableview', place this line:

Code: Select all

header('Location: tablename_view.php?SelectedID=1');
When the table is selected from either homepage or dropdown, it is redirected to the detail view for record 1.

When the back/cancel button is clicked from the detail view, it simply reloads the detail view.

Perfect!

Post Reply