HOW TO INTERPRET HTLM AND CSS CODE IN DATA TO PDFHTML5

HOW TO INTERPRET HTLM AND CSS CODE IN DATA TO PDFHTML5

aicha92aicha92 Posts: 1Questions: 1Answers: 0

Hi,

I have a problem exporting with pdfhtml5. I have data on datatable with HTML and CSS style and want to visualize it on pdf or another plugin.

this is the variable exportOptions

var thisExportOptions = {
        exportOptions: {
            rows: function(idx, data, node) {
                var checkedB = sontCoches(".dt-class-checkbox", "entireRow");
                var dt = new $.fn.dataTable.Api('#datatable-configuration');
                $(checkedB).each(function(i, v) {
                    dt.row(this).select();
                });
                var selected = dt.rows({ selected: true }).indexes().toArray();
                if (selected.length === 0 || $.inArray(idx, selected) !== -1)
                    return true;
                return false;
            },
            columns: ':visible'
        }
    };

and thus for datatable id

var table = $('#datatable-configuration').DataTable({
"ajax": {
            "url": "/backend/index.php",
            "dataType": "json",
            "type": "GET",
            "data": {
                "app": get ["app"],
                "module": get ["module"],
                "element": cElement,
                "action": "serverside",
                "actionParent": get ["action"],
                //"get": get,
            }
        },
"buttons": [
            $.extend(true, {}, thisExportOptions, { text: 'Imprimer', extend: 'print' }),
            $.extend(true, {}, thisExportOptions, { text: 'PDF', extend: 'pdfHtml5' }),

            { extend: 'colvis', text: 'Export colonnes', className: 'btn-primary', columns: ":not(.notConcernedByColvis)" }
        ],
 "fnStateLoad": function(oSettings) {
            return JSON.parse(localStorage.getItem('dataTableStore'));
        },
        "stateSaveParams": function(settings, data) {
                data.columns.forEach(function(column) {
                    delete column.visible;
                });
            }

)}

Php code

$datas[$key]['nom'] = "<span class='font-weight-bold text-success'>" . $brute->raison_sociale . "</span>";
                            $datas[$key]['nom'] .= (!empty($brute->rcs_siret)) ? "<br /><small><span class='font-weight-bold'>RCS : </span><span class='right'>" . $brute->rcs_siret . "</span></small>" : "";
                            $datas[$key]['autres'] = '';

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    No need to shout :)

    I'm not actually clear what the issue is. Are you saying the PDF export isn't working? Or something else I've not understood. Also, please link to a test case showing the issue.

    Thanks,
    Allan

Sign In or Register to comment.