Additional CSV Button

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
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Additional CSV Button

Post by angus » 2023-06-01 15:42

Is it possible to create a new csv button and add it next to the 'Save CSV' that is already there. Also how would I then specify only specific columns for that button to download?

has anyone done this before or could point me in the right direction?
AppGini 22.13

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Additional CSV Button

Post by angus » 2023-06-05 17:43

I have managed to put something together, I copied the csv function the _view.php and renamed it by adding 2 on the end. I then updated the datalist.php and copied the function for exporting there. I know not ideal and these will be overwritten but I can manage that locally.
Screenshot 2023-06-05 184244.png
Screenshot 2023-06-05 184244.png (7.41 KiB) Viewed 2406 times
AppGini 22.13

User avatar
zibrahim
Veteran Member
Posts: 137
Joined: 2020-01-28 18:30
Location: Malaysia

Re: Additional CSV Button

Post by zibrahim » 2023-06-05 23:41

You can use the following code as sample to add extra button
file : hooks/TABLENAME-tv.js

Code: Select all

// create additional button to the tableview
jQuery(function () {
    jQuery('#CSV').after(
        '<button class="btn btn-default" type="button" id="gantt-chart"><i class="glyphicon glyphicon glyphicon-minus"></i> Gantt Chart</button>'
    );
    jQuery('button[id=gantt-chart]').click(function () {
        window.location = 'hooks/project_gantt.php';
    });
});
SCR-20230606-hhww.png
SCR-20230606-hhww.png (12.87 KiB) Viewed 2399 times
Have a nice day.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Additional CSV Button

Post by angus » 2023-06-07 10:51

perfect, thanks
AppGini 22.13

Post Reply