Get data for field in selected record of table 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
David Soul
Veteran Member
Posts: 31
Joined: 2018-01-04 18:32
Location: Vancouver, Canada
Contact:

Get data for field in selected record of table view

Post by David Soul » 2020-08-13 06:01

I am using AppGini Helper to add a link to each record in table view of “Players”

Code: Select all

 jQuery(function () {
 var tv = new AppGiniTableView();
 var href = "hooks/global-search.php?search=";
 tv.addLink(href, "flash", "global search");

});
I would like to add the data from the “name” field of the selected record in “Players” (after search= )but don’t know how to go about that; any assistance will be greatly appreciated.
David HC Soul

Core::AppGini 5.93
Plugins: Search Page Maker + Summary Reports + Mass update plugin
Bizzworxx: AppGini Helper JavaScript Library + AppGini Helper Detail View Plug-in + AppGini Helper pack
Utilities: Global Search utility

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

Re: Get data for field in selected record of table view

Post by jsetzer » 2020-08-13 08:48

Code: Select all

jQuery(function () {

    var tv = new AppGiniTableView();
    var href = "hooks/global-search.php?search=";
    tv.addLink(href, "flash", "global search");

    let cn = "name"; // <-------------------YOUR column name here
    let tn = AppGini.currentTableName();
    jQuery("tr[data-id]").each((i, e) => {
        let value = jQuery(e).find("td." + tn + "-" + cn).text();
        jQuery(e).find("td:eq(0) > .btn-group > a[href]").each((i, e) => {
            let a = jQuery(e); a.attr("href", a.attr("href") + value);
        });
    });

});
This should work for the use case you have described. I have tested this in one of my tables with column name serialnumber.

chrome_LpHsfd0xxi.png
chrome_LpHsfd0xxi.png (20.51 KiB) Viewed 1528 times
chrome_eRsaN2MYa9.png
chrome_eRsaN2MYa9.png (2.66 KiB) Viewed 1528 times

Regards,
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

David Soul
Veteran Member
Posts: 31
Joined: 2018-01-04 18:32
Location: Vancouver, Canada
Contact:

Re: Get data for field in selected record of table view

Post by David Soul » 2020-08-13 21:04

Success!

Once again a big thank you Jan!

The site I am putting together for a Canadian Charity (Hall of Fame/museum/archive) would be nowhere near as fit for task, nor near as user friendly, without your AppGini Helper and the “above and beyond” time you spend helping the entire AppGini community here.

Certainly - as a “non-coder” - I wouldn’t be able to do this work without APPGini, the tools In your product, and the work you and the rest of the “AppGini Super Hero” members so graciously give.
David HC Soul

Core::AppGini 5.93
Plugins: Search Page Maker + Summary Reports + Mass update plugin
Bizzworxx: AppGini Helper JavaScript Library + AppGini Helper Detail View Plug-in + AppGini Helper pack
Utilities: Global Search utility

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

Re: Get data for field in selected record of table view

Post by jsetzer » 2020-08-16 19:13

Thank you, David!
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

Post Reply