List Manager Forum

Require a filter before exporting

User pbmresearch 2015-10-21 21:04:20

Is it possible to require a user to filter a list before being able to export?
I have more than 30K records and if they export the entire list, it times out. I would like to limit them being able to do that.

Moonsoft support 2015-10-22 11:56:14

Hi,
there is no configuration parameter for that purpouse. We think forcing a filter won't fully solve your problem because user can launch a filter that can exclude for ex just 100 or 200 records, thus not avoiding the mass export and your server timeout.
We suggest another approach instead, a good guess of how many records user is trying to export is the number of total pages * the number of records per page being shown, so you could add a simple js tweak with a limit on this number. This would be the code:

var numrecords=LMJQ("").val()*LMJQ("").html();
if(numrecords>1000){
alert("Your message here");
return true;
}


You can change the 1000 limit for the number of records you prefer



This tweak can be included at the beginning of the functions of the export buttons you're using

JOOMLA\modules\mod_listmanager\tmpl\content.php

LMJQ('..........exportexcelfiltered').click(function(e) {

//the code here


LMJQ('..........exportpdffiltered').click(function(e) {

//the code here


LMJQ('............exportrtffiltered').click(function(e) {

//the code here


etc.


It will restrict the filtered export to the number of records you configure, hope this will do the work for your case.


Regards

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!