Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter guil182

    (@guil182)

    Hi,

    I have a problem.

    Here the final code :

    "buttons": [
        {
            "extend": "pdfHtml5",
            "exportOptions": {
                "columns": [ 0,1,3,4,5,6,8 ]
            }
        },
        {
            "extend": "excelHtml5",
            "exportOptions": {
                "columns": [ 0,1,2,3,4,5,6,7,8 ]
            }
        }
    ]

    No problem on firefox but only the first button is visible on safari ..:/

    Do you known why ?

    Regards

    Thread Starter guil182

    (@guil182)

    Ok,
    So, in custom command, you add :
    "buttons": [{"extend": "pdfHtml5","exportOptions": { "columns": [ 0, 1, 2, 3,4,5,6,7,8 ] } } ]

    and it’s ok to choose your exported columns.

    Thread Starter guil182

    (@guil182)

    hi,

    I will see…

    For the second problem, we can choose the column with the plugin : https://datatables.net/extensions/buttons/examples/html5/columns.html

    But, where is this code `extend: ‘pdfHtml5’,
    exportOptions: {
    columns: [ 0, 1, 2, 5 ]
    }`
    in your plugin ?

    Regards

    Thread Starter guil182

    (@guil182)

    Hi,

    I copied JSON file for my langage and for EN and FR, i don’t want space for thousands

    {
    	"emptyTable":		"Aucun élément à afficher",
    	"info":				"Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
    	"infoEmpty":		"Affichage de l'élement 0 à 0 sur 0 éléments",
    	"infoFiltered":		"(filtré de _MAX_ éléments au total)",
    	"infoPostFix":		"",
    	"lengthMenu":		"Afficher _MENU_ éléments",
    	"loadingRecords":	"Chargement en cours...",
    	"processing":		"Traitement en cours...",
    	"search":			"Rechercher:",
    	"zeroRecords":		"Aucun élément à afficher",
    	"paginate": {
    		"first":		"Premier",
    		"previous":		"Précédent",
    		"next":			"Suivant",
    		"last":			"Dernier"
    	},
    	"aria": {
    		"sortAscending":	": activer pour trier la colonne par ordre croissant",
    		"sortDescending":	": activer pour trier la colonne par ordre décroissant"
    	},
    	"decimal":			",",
    	"thousands":		""
    }

    But it don’t work. I always have a space on my table and 2 000,00 € in export ??

    regards

    Thread Starter guil182

    (@guil182)

    2 000,00 €

    Thread Starter guil182

    (@guil182)

    ah problem with the message format…grrr

    2 000,00 €

    Thread Starter guil182

    (@guil182)

    it’s about TablePress Extension: DataTables Buttons

    the table is ok on wordpress but when i push one on the buttons, numbers exported are like this “2 000,00 €”

    the second question is when a have a 5 columns table and i only want to export 4 columns when a push a button….it’s possible ?

    Regards

    Thread Starter guil182

    (@guil182)

    resolved

    Thread Starter guil182

    (@guil182)

    hi,

    That’s was it ! Perfect !
    Thanks you very much for all.

    Regards

    Guillaume

    Thread Starter guil182

    (@guil182)

    Hi,

    hum….maybe it’s an other problem…..
    I waited 8 hours, modified the code and nothing…..
    it seems rather that $ tabletools_options not be used / read ?

    Regards

    Thread Starter guil182

    (@guil182)

    hi,

    i modified tablepress-datatables-tabletools.php.

    here the code :

    <?php
    
    /*
    
    Plugin Name: TablePress Extension: DataTables TableTools
    
    Plugin URI: https://tablepress.org/extensions/datatables-tabletools/
    
    Description: Custom Extension for TablePress to add the DataTables TableTools functionality
    
    Version: 1.1
    
    Author: Tobias B?thge
    
    Author URI: https://tobias.baethge.com/
    
    */
    
    /**
    
     * Register necessary Plugin Filters
    
     */
    
    add_filter( 'tablepress_shortcode_table_default_shortcode_atts', 'tablepress_add_shortcode_parameters_tabletools' );
    
    add_filter( 'tablepress_table_js_options', 'tablepress_add_tabletools_js_options', 10, 3 );
    
    add_filter( 'tablepress_datatables_command', 'tablepress_add_tabletools_js_command', 10, 5 );
    
    if ( ! is_admin() )
    
    	add_action( 'wp_enqueue_scripts', 'tablepress_enqueue_tabletools_css' );
    
    /**
    
     * Add "datatables_tabletools" as a valid parameter to the [table /] Shortcode
    
     */
    
    function tablepress_add_shortcode_parameters_tabletools( $default_atts ) {
    
    	$default_atts['datatables_tabletools'] = false;
    
    	return $default_atts;
    
    }
    
    /**
    
     * Pass "datatables_tabletools" from Shortcode parameters to JavaScript arguments
    
     */
    
    function tablepress_add_tabletools_js_options( $js_options, $table_id, $render_options ) {
    
    	$js_options['datatables_tabletools'] = $render_options['datatables_tabletools'];
    
    	// register the JS
    
    	if ( $js_options['datatables_tabletools'] ) {
    
    		$js_tabletools_url = plugins_url( 'js/TableTools.min.js', __FILE__ );
    
    		wp_enqueue_script( 'tablepress-tabletools', $js_tabletools_url, array( 'tablepress-datatables' ), '2.1.5', true );
    
    	}
    
    	return $js_options;
    
    }
    
    /**
    
     * Evaluate "datatables_tabletools" parameter and add corresponding JavaScript code, if needed
    
     */
    
    function tablepress_add_tabletools_js_command( $command, $html_id, $parameters, $table_id, $js_options ) {
    
    	if ( ! $js_options['datatables_tabletools'] )
    
    		return $command;
    
    	$table_wrapper = "{$html_id}_wrapper";
    
    	$html_id = str_replace( '-', '_', $html_id );
    
    	$table_name = "oTable_{$html_id}";
    
    	$tabletools_name = "oTableTools_{$html_id}";
    
    	$command = substr( $command, 0, -1 ); // removing ; at the end
    
    	$swf_path = plugins_url( 'swf/copy_csv_xls_pdf.swf', __FILE__ );
    
    	// with text (somme CSS needs to commented out!):
    
    	//$tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ "copy", "print", { "sExtends": "collection", "sButtonText": "Save as", "aButtons": [ "csv", "xls", "pdf" ] } ] }';
    
    	// with images:
    
    	$tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ { "sExtends": "copy", "sButtonText": "" }, { "sExtends": "csv", "sButtonText": "" }, { "sExtends": "xls", "sButtonText": "" }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "sButtonText": "", "mColumns": [ 0, 1, 4 ], "sButtonText": "" }, { "sExtends": "print", "sButtonText": "" } ] }';
    
    	$command = "var {$table_name} = {$command}, {$tabletools_name} = new TableTools({$table_name}, {$tabletools_options}); $('#{$table_wrapper}').before({$tabletools_name}.dom.container);";
    
    	return $command;
    
    }
    
    function tablepress_enqueue_tabletools_css() {
    
    	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
    
    	$tabletools_css_url = plugins_url( "css/TableTools{$suffix}.css", __FILE__ );
    
    	wp_enqueue_style( 'tablepress-tabletools-css', $tabletools_css_url, array(), '2.1.5' );
    
    }
    Thread Starter guil182

    (@guil182)

    hi,

    yes, of course.
    here the site : https://www.lenclosdesvins.com/catalogue/

    and here for code : https://datatables.net/extras/tabletools/button_options

    with sPdfOrientation and mColumns.

    Thanks you for your help

    Thread Starter guil182

    (@guil182)

    hi, thanks for the answer.

    I change this line :

    $tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ { "sExtends": "copy", "sButtonText": "" }, { "sExtends": "csv", "sButtonText": "" }, { "sExtends": "xls", "sButtonText": "" }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "sButtonText": "", "mColumns": [ 0, 1, 4 ], "sButtonText": "" }, { "sExtends": "print", "sButtonText": "" } ] }';

    But no effect….:(

Viewing 13 replies - 1 through 13 (of 13 total)