Capturing selectedID in detail view

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
bdurfee
Veteran Member
Posts: 32
Joined: 2013-02-07 17:44

Capturing selectedID in detail view

Post by bdurfee » 2020-03-16 17:56

For a detail view of a record, I want to display the selectedID of the record above the table heading. I'm using the header-extras.php file to add display it. When a user clicks on a record in table view, how to I capture the selectedID of the record so I can use it in header-extras.php?

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Capturing selectedID in detail view

Post by jsetzer » 2020-03-16 18:24

Hi,

do you really mean in "[...] detail view [...] above the table heading"?
I think there is no table in detail view.

Perhaps you can upload a screenshot and highlight the place you mean?

Best,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

bdurfee
Veteran Member
Posts: 32
Joined: 2013-02-07 17:44

Re: Capturing selectedID in detail view

Post by bdurfee » 2020-03-16 20:33

I want to capture the record ID and use it in header-extras.php. The header-extras.php file in the hooks folder always puts the extra text above the page heading. The image below is the detail view of a particular record. "Additional text goes here." indicates where the output from header-extras.php would appear.

Image

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Capturing selectedID in detail view

Post by jsetzer » 2020-03-16 20:54

If you want to add the selected id about the header of the detail view, let me give it a first try. It's a bit tricky to avoid showing the id only in detail view and not in table view. Maybe someone else here will have a different and better approach?

Code in hooks/header-extras.php for inserting the selected record id above the header of a detail view:

Code: Select all

<?php 

// file: hooks/header-extras.php

if (isset($_REQUEST["SelectedID"]) && $_REQUEST["current_view"]==="TV") { ?>
    <h1 class="well text-center">Id: <?=$_REQUEST["SelectedID"]?></h1>
<?php } ?>
ezgif.com-resize (1).gif
ezgif.com-resize (1).gif (192.74 KiB) Viewed 4753 times

Is this what you were looking for?

Best,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

bdurfee
Veteran Member
Posts: 32
Joined: 2013-02-07 17:44

Re: Capturing selectedID in detail view

Post by bdurfee » 2020-03-17 02:13

That was exactly it! Thanks!

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

Re: Capturing selectedID in detail view

Post by onoehring » 2020-03-21 13:31

Hi

I do not trust the "TV" as it seems (for me not to be set consistent).
In my Column-Value-Based-Permissions, I am using this approach to see if a detailview is requested (see my footer and read docs in the extension zip):

Code: Select all

$checkSelectedID = isset($_POST['SelectedID']) ? makeSafe($_POST['SelectedID']) : 0;    // check POST first!
$checkSelectedID = isset($_GET['SelectedID']) ? makeSafe($_GET['SelectedID']) : $checkSelectedID;  // if GET exist, overwrite POST!
If $checkSelectedID <> 0 then detailview requested.

Olaf

Post Reply