I am using a Direct Web Remoting (DWR) JavaScript library file and am getting an error in chrome browser
It says
jquery-2.1.1.min.js?v=4.5:2 Uncaught RangeError: Maximum call stack size exceeded
at fb (jquery-2.1.1.min.js?v=4.5:2)
at Array.<anonymous> (jquery-2.1.1.min.js?v=4.5:2)
at jquery-2.1.1.min.js?v=4.5:2
at f (jquery-2.1.1.min.js?v=4.5:2)
at fb.select (jquery-2.1.1.min.js?v=4.5:2)
at Function.fb [as find] (jquery-2.1.1.min.js?v=4.5:2)
at n.fn.init.find (jquery-2.1.1.min.js?v=4.5:2)
at exportTableToCSV (user:746)
at allPayPeriodSummary-controller.js?v=4.5:331
I am using this code for download file from html table in angularjs
$scope.exportPayPeriods = function(){
$scope.enableCsv = true;
setTimeout(function(){
exportTableToCSV.apply(this, [$('#payPeriod-list-for-csv>table'), 'payPeriod.csv']);
$scope.enableCsv = false;
}, 200);
};
JS function
function exportTableToCSV($table, filename) {
var $rows = $table.find('tr:has(td),tr:has(th)'),
// Temporary delimiter characters unlikely to be typed by keyboard
// This is to avoid accidentally splitting the actual contents
tmpColDelim = String.fromCharCode(11), // vertical tab character
tmpRowDelim = String.fromCharCode(0), // null character
// actual delimiter characters for CSV format
colDelim = '","', rowDelim = '"\r\n"',
// Grab text from table into CSV formatted string
csv = '"' + $rows.map(function(i, row) {
var $row = $(row), $cols = $row.find('td,th');
return $cols.map(function(j, col) {
var $col = $(col), text = $col.text();
return text.replace('"', '""'); // escape double quotes
}).get().join(tmpColDelim);
}).get().join(tmpRowDelim).split(tmpRowDelim).join(rowDelim).split(tmpColDelim).join(colDelim) + '"',
// Data URI
csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csv);
$(this).attr({
'download' : filename,
'href' : csvData,
'target' : '_blank'
});
};
I found one similar one Maximum call stack size exceeded error
In my case its difficult to find that location that where it is creating issue.
Someone please help to find the issue
Thanks