Import CSV file more than 20 lines Aw Snap ERROR
Import CSV file more than 20 lines Aw Snap ERROR
Debugger code (debug.datatables.net):
N/A
Description of problem:
An "Aw Snap" error occurred in Chrome when importing a CSV file with more than 20 lines, only 3KB. I attached the CSV files
The source code is standard using this example
https://editor.datatables.net/examples/extensions/import.html
The php.ini max_input_vars is already set to 120,000
Map fields
Error messages shown:
After click the Import button, got this error
I have custom the selectColumn to hide some fields
function selectColumns ( editor, csv, header ) {
var selectEditor = new $.fn.dataTable.Editor();
var fields = editor.order();
j = 0;
for ( var i=0 ; i<fields.length ; i++ ) {
var field = editor.field( fields[i] );
hide = ['PERIOD','REV_NO','STATUS'];
if (hide.indexOf(field.name())==-1) {
selectEditor.add( {
label: field.label(),
name: field.name(),
type: 'select',
options: header,
def: header[j]
} );
j++;
}
}
selectEditor.create({
title: 'Map CSV fields',
buttons: 'Import '+csv.length+' records',
message: 'Select the CSV column you want to use the data from for each field.'
});
selectEditor.on('submitComplete', function (e, json, data, action) {
// Use the host Editor instance to show a multi-row create form allowing the user to submit the data.
editor.create( csv.length, {
title: 'Confirm import',
buttons: 'Submit',
message: 'Click the <i>Submit</i> button to confirm the import of '+csv.length+' rows of data. Optionally, override the value for a field to set a common value by clicking on the field below.'
} );
for ( var i=0 ; i<fields.length ; i++ ) {
var field = editor.field( fields[i] );
var mapped = data[ field.name() ];
for ( var j=0 ; j<csv.length ; j++ ) {
field.multiSet( j, csv[j][mapped] );
}
}
} );
Please help!
Answers
already solved after using standard code (without hiding the field)
Thanks for reporting back, glad sorted,
Colin