View | Details | Raw Unified | Return to bug 40525
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js (-2 / +28 lines)
Lines 428-433 function _dt_buttons(params) { Link Here
428
        },
428
        },
429
    };
429
    };
430
430
431
    const export_format_spreadsheet = {
432
        body: function (data, row, column, node) {
433
            const newnode = node.cloneNode(true);
434
            const no_export_nodes = newnode.querySelectorAll(".no-export");
435
            no_export_nodes.forEach(child => {
436
                child.parentNode.removeChild(child);
437
            });
438
            //Note: innerHTML is the same thing as the data variable,
439
            //minus the ".no-export" nodes that we've removed
440
            //Note: See dataTables.buttons.js for original function usage
441
            let str = DataTable.Buttons.stripData(newnode.innerHTML, {
442
                decodeEntities: false,
443
                stripHtml: true,
444
                stripNewlines: true,
445
                trim: true,
446
                escapeExcelFormula: true,
447
            });
448
            //Note: escapeExcelFormula only works from Buttons 3.2.0+, so
449
            //we add a workaround for now
450
            const unsafeCharacters = /^[=+\-@\t\r]/;
451
            if (unsafeCharacters.test(str)) {
452
                str = "'" + str;
453
            }
454
            return str;
455
        },
456
    };
457
431
    let buttons = [
458
    let buttons = [
432
        {
459
        {
433
            fade: 100,
460
            fade: 100,
Lines 448-454 function _dt_buttons(params) { Link Here
448
            text: __("CSV"),
475
            text: __("CSV"),
449
            exportOptions: {
476
            exportOptions: {
450
                columns: exportColumns,
477
                columns: exportColumns,
451
                format: export_format,
478
                format: export_format_spreadsheet,
452
            },
479
            },
453
        },
480
        },
454
        {
481
        {
455
- 

Return to bug 40525