How can I show the children record button like appgini does in the detail view?

This sub-forum is for discussing all topics related to AppGini Helper JavaScript Library, provided by bizzworxx as a third-party AppGini plugin.
Post Reply
nycwebmaster
Veteran Member
Posts: 89
Joined: 2015-11-23 01:02

How can I show the children record button like appgini does in the detail view?

Post by nycwebmaster » 2022-02-11 20:22

How can I show the children record button like appgini does in the detail view?

I have latest versions of appgini and appginihelper.

How can I show a button in the table view that will take you to the children's records?

Image


Image


Image

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

Re: How can I show the children record button like appgini does in the detail view?

Post by jsetzer » 2022-02-11 21:01

Maybe I do not understand your question:

The detail view's children-link is a feature of the detail view. It shows a filtered list of child record which are related to exactly one detail record.

For example a course has students.

In table view there are many records, each may have various children records. So, which of them shall be listed when clicking the additional button(s)?

Can you please explain your use case a bit more. You can add buttons or links to the first column of every row. And you can set javascript function or links per button per row.
Kind regards,
<js />

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

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

Re: How can I show the children record button like appgini does in the detail view?

Post by jsetzer » 2022-02-11 21:40

Use the .addLink() function of AppGini Helper Javascript Library with href like...

Code: Select all

CHILDTABLENAME_view.php?filterer_FKCOLUMNNAME=%ID%
This should open the TV of CHILDTABLENAME and list all records filtered by foreign key.

(see example in next post)
Kind regards,
<js />

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

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

Re: How can I show the children record button like appgini does in the detail view?

Post by jsetzer » 2022-02-12 09:00

Here is an example.

Model

Table partners has children records of table contacts.
contacts.partner_id is lookup referencing partners table.

chrome_v82WgKUuqW.png
chrome_v82WgKUuqW.png (4.22 KiB) Viewed 386 times

Code

The following code produces that inline-toolbar per row. The last button (better so say "link") opens a filtered page of contacts filtered by contacts.partner_id of the specific partner-recor (per row).

Code: Select all

$j(document).ready(function () {

    AppGiniHelper.TV
        .addOpenButton()
        .addLink("partners_mindmap.php?SelectedID=%ID%", "record")
        .addLink("partners_tree.php?SelectedID=%ID%", "align-left")
        .addLink("contacts_view.php?filterer_partner_id=%ID%", "user", "...") // see this line!
        .setWidth(0, 180);
});
First parameter of .addLink() function is the HREF. Note that the placeholder %ID% will be replaced by the primary key of each individual row.

Output

This is the result:

chrome_Utt1A3GSgR.png
chrome_Utt1A3GSgR.png (18.56 KiB) Viewed 386 times

Screenrecording

ezgif.com-gif-maker (6).gif
ezgif.com-gif-maker (6).gif (254.15 KiB) Viewed 386 times
Kind regards,
<js />

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

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

Re: How can I show the children record button like appgini does in the detail view?

Post by jsetzer » 2022-02-12 09:22

If you just want to add buttons to the top toolbar of Table View (TV), check out the following code:

Code

Code: Select all

// file: hooks/TABLENAME-tv.js
$j(document).ready(function () {
  AppGiniHelper.TV.getTopButtons()
    .addLink("index.php", "cog", "Custom Button #1", Variation.info, "Do you really want to hurt me?")
    .addButton(function () { alert("Clack!") }, "flash", "Custom #2 - Click", Variation.Primary, "Do you really want to make me cry?")
    .addLink("admin/pageHome.php", "cog", "Admin Area", Variation.danger);
});
Parameters:
  • AddLink
    1. HREF
    2. icon name
    3. (optional) Caption
    4. (optional) Variation
    5. (optional) Prompt (for confirmation dialog)
  • AddButton
    1. Javascript function call
    2. icon name
    3. (optional) Caption
    4. (optional) Variation
    5. (optional) Prompt (for confirmation dialog)

Output

chrome_EQ2GjIhouf.png
chrome_EQ2GjIhouf.png (29.7 KiB) Viewed 385 times

Screenrecording

ezgif.com-gif-maker (7).gif
ezgif.com-gif-maker (7).gif (95.79 KiB) Viewed 385 times
Kind regards,
<js />

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

Post Reply