Tabletools custom button parameters

Tabletools custom button parameters

jrizzi1jrizzi1 Posts: 44Questions: 12Answers: 3
edited July 2015 in Free community support

I am using tabletools 2.2.4 / datatables 1.10 and am trying to figure out how to send parameters on the custom button click
this is in the datatables()

    "tableTools": {
                "aButtons": [

                    {
                        "sExtends": "download",
                        "sButtonText": "Save to CSV",
                        "sUrl":"handlers/tagsearch.ashx",
                        "sExtraData": [
                          { "name":"operation", "value":"downloadcsv" }
                          ,{ "name":"tags", "value":$('#tags').val() }
                        ]
                    },
                ]
            }

and before the datatables object i have this

$.fn.dataTable.TableTools.buttons.download = $.extend(
    true,
    {},
    $.fn.dataTable.TableTools.buttonBase,
    {
      "fnClick": function( button, conf ) {
           var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
           oParams.push({name: "tags", value: $("#tags").val() });

        var iframe = document.createElement('iframe');
        iframe.style.height = "0px";
        iframe.style.width = "0px";
        iframe.src = conf.sUrl+"?"+$.param(oParams);
        document.body.appendChild( iframe );
      },
    }
);

I have tried passing the form values as extradata and as added on the fnClick event, neither have worked

I have previously used tabletools 2.1.5 and had the following function working, but this does not seem to work once i updated the tabletools script

TableTools.BUTTONS.download = {
    "sAction": "text",
    "sTag": "default",
    "sFieldBoundary": "",
    "sFieldSeperator": "\t",
    "sNewLine": "<br>",
    "sToolTip": "",
    "sButtonClass": "DTTT_button_text",
    "sButtonClassHover": "DTTT_button_text_hover",
    "sButtonText": "Download",
    "mColumns": "all",
    "bHeader": true,
    "bFooter": true,
    "sDiv": "",
    "fnMouseover": null,
    "fnMouseout": null,
    "sExtraData":[],
    "fnClick": function( nButton, oConfig ) {
    var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
      oParams.push({name: "tags", value: $("#tags").val() });   

    var iframe = document.createElement('iframe');
    iframe.style.height = "0px";
    iframe.style.width = "0px";
    iframe.src = oConfig.sUrl+"?"+$.param(oParams);
    document.body.appendChild( iframe );
    },
    "fnSelect": null,
    "fnComplete": null,
    "fnInit": null
};

I believe the part that is not translating is the var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );

any ideas?

This discussion has been closed.