Page 1 of 1

Additional CSV Button

Posted: 2023-06-01 15:42
by angus
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?

Re: Additional CSV Button

Posted: 2023-06-05 17:43
by angus
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 4500 times

Re: Additional CSV Button

Posted: 2023-06-05 23:41
by zibrahim
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 4493 times
Have a nice day.

Re: Additional CSV Button

Posted: 2023-06-07 10:51
by angus
perfect, thanks