Display detail view only?

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
GreenWyvern
Posts: 8
Joined: 2013-04-05 09:23

Display detail view only?

Post by GreenWyvern » 2013-04-05 09:26

I have a Settings table which has only one record, and will never have more than one record.

I would like the user to see the detail view immediately, without having to click on the record. I've looked at the hooks, but there doesn't seem to be any obvious way to do it.

a) Is there any way to display only the detail view and not the browse view for this table?

b) If not, is there a way to automatically select the record and display both views immediately when the user goes to that table?

Many thanks!

Johnk
AppGini Super Hero
AppGini Super Hero
Posts: 68
Joined: 2013-01-09 03:47
Location: Cairns, Australia

Re: Display detail view only?

Post by Johnk » 2013-04-05 13:07

Welcome to the forum. It's gone a bit quiet over the Easter break but maybe your post will wake a few people up :-)

Have you tried using "Don't show in Detail View" or Don't show in Table View"? I have no idea how the screen will display because I'm moving house and answering from my Netbook that doesn't have Appgini installed. I have a similar one-liner in End of financial year. I fill this in as admin and show it as a display field on a form.
Regards,

John

GreenWyvern
Posts: 8
Joined: 2013-04-05 09:23

Re: Display detail view only?

Post by GreenWyvern » 2013-04-05 13:23

Thanks for your reply, John. I've tried that but it doesn't work.

What I really need is an easy way to change the link from the home page, so that it goes directly to the detail view. And then also remove the 'Back' button from the detail view.

GreenWyvern
Posts: 8
Joined: 2013-04-05 09:23

Re: Display detail view only?

Post by GreenWyvern » 2013-04-05 15:07

Ok - worked out how to do it:

1. Hide table in Home Page and Nav Menu
2. Insert links in links-home.php and links-nav.php pointing to table_view.php?SelectedID=1
3. Detail view on separate page
4. Comment out 'Back' button in table_dml.php

:)

Johnk
AppGini Super Hero
AppGini Super Hero
Posts: 68
Joined: 2013-01-09 03:47
Location: Cairns, Australia

Re: Display detail view only?

Post by Johnk » 2013-04-07 09:10

Thanks for the reply and thanks for sharing your solution. it's amazing how many people don't. Forums are all about helping each other and that's just what you've done. Just one quick question to tie it altogether though. Can you supply the full line(s) of code you entered in each of the files in step 2 or is that it? It could help someone else - including muggins :-)

John

GreenWyvern
Posts: 8
Joined: 2013-04-05 09:23

Re: Display detail view only?

Post by GreenWyvern » 2013-04-07 10:26

Johnk wrote:Thanks for the reply and thanks for sharing your solution. it's amazing how many people don't. Forums are all about helping each other and that's just what you've done. Just one quick question to tie it altogether though. Can you supply the full line(s) of code you entered in each of the files in step 2 or is that it? It could help someone else - including muggins :-)

John
Here is the code in step 2 - it's very simple:

In links-home.php I put

Code: Select all

$homeLinks[] = array(
			'url' => 'settings_view.php?SelectedID=1', 
			'title' => 'Settings', 
			'description' => '<br/>Global settings',
			'groups' => array('*')
		    );

And in links-navmenu.php something very similar:

Code: Select all

$navLinks[] = array(
			'url' => settings_view.php?SelectedID=1', 
			'title' => 'Settings', 
			'groups' => array('*')
			);

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

Re: Display detail view only?

Post by peebee » 2013-04-08 04:05

Or you could apply a default filter as per this tutorial:

http://bigprof.com/appgini/tips-and-tut ... ult-filter

GreenWyvern
Posts: 8
Joined: 2013-04-05 09:23

Re: Display detail view only?

Post by GreenWyvern » 2013-04-08 06:20

peebee wrote:Or you could apply a default filter as per this tutorial:

http://bigprof.com/appgini/tips-and-tut ... ult-filter
No, a filter won't work. I don't want the user to see the table view at all, only the detail view.

sethnewton
Posts: 3
Joined: 2014-05-01 20:40

Re: Display detail view only?

Post by sethnewton » 2014-05-01 20:46

I've been scouring the web for this exact issue. I saw that the OP has a workaround, but that also assumes that the record has been created before creating the hook. For example, if SelectedID=2 does not exist, then nothing will show on this page.

Surely there's a "proper" way to handle "Settings" type pages, no? I have criteria needed to save to ONE record per registered user. I don't want the user to create more than 1 record, I just want them to update one record. Does that make sense?

primitive_man
AppGini Super Hero
AppGini Super Hero
Posts: 54
Joined: 2014-03-09 20:20

Re: Display detail view only?

Post by primitive_man » 2014-07-24 09:17

Yes, this does make sense - For example, a record of a patient's death should occur once and once only!

TheCodeRed
Posts: 26
Joined: 2014-05-01 12:57

Re: Display detail view only?

Post by TheCodeRed » 2014-07-24 18:06

How are you guys handling the SelectID? Doesn't the detail view require an ID to view? Is everybody being sent to the same record or what? Though I could see this being useful for settings and configurations tables in AppGini applications. A table where you may only have a single record that can be viewed or modified but no extra records can be created.

TheCodeRed
Posts: 26
Joined: 2014-05-01 12:57

Re: Display detail view only?

Post by TheCodeRed » 2014-07-24 18:14

"Postby sethnewton » 01 May 2014, 15:46
I've been scouring the web for this exact issue. I saw that the OP has a workaround, but that also assumes that the record has been created before creating the hook. For example, if SelectedID=2 does not exist, then nothing will show on this page.

Surely there's a "proper" way to handle "Settings" type pages, no? I have criteria needed to save to ONE record per registered user. I don't want the user to create more than 1 record, I just want them to update one record. Does that make sense?"

I have used similar systems to this. That is easily accomplished by letting the user only view/modify but not delete THEIR record in the table through member group permissions. As an admin you can create a default record for the user and assign ownership to that user. Again, they cannot create new records so they should only see the one record that is available to them. You can use this menulinks method to show direct link to that record to top it all off.

csr21
Posts: 5
Joined: 2014-08-25 11:07

Re: Display detail view only?

Post by csr21 » 2014-08-26 09:02

I think your problem is very simple.
Try this, if it fulfils your requirement.

in file tablename_view,php, find this line
$x->SeparateDV = 1;
change this to
$x->SeparateDV = 0;

this will show detail view just below the table view.
also if you are sure that this table will never have more than 1 record, you can find the line
$x->RecordsPerPage = 10;
change this to
$x->RecordsPerPage = 2;

Please confirm, if this fulfils your requirement.


pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Display detail view only?

Post by pbottcher » 2021-04-10 15:18

Just redirect the user in the hooks/TABLENAME.php -> _init function to the detail view.

To do so, check if the request contains already a SelectedID, if so no action required, otherwise, retrieve the correct PK for the user and redirect to the

TABLENAME_view.php?SelectedID=ID_FOR_THIS_USER
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Display detail view only?

Post by onoehring » 2021-04-11 06:37

Hi,

I admit not reading everything from above. Can't you use in AG: "Detailview in seperate page" AND in the hooks/tablename.php -> _init function this:

Code: Select all

$options->SeparateDV = 1;	// 1= seperate DV, 0= TV+DV on one page
This way I am showing some program settings to the user without any tableview.
In the hooks/tablename.php -> before_insert function I also set a)

Code: Select all

return false

and in the before_delete function b)

Code: Select all

return false

This a) disables adding a new record and b) removing the current (only) record.

Olaf

Post Reply