Table data with post

Table data with post

SeDoSeDo Posts: 8Questions: 0Answers: 0
edited June 2012 in TableTools
Hi,

First off, amazing script.
I'm using the download post + get method, http://datatables.net/extras/tabletools/plug-ins.

What I'm trying to do is to get this to a text file, every line has a column in the table:
1
00:01:02,425 --> 00:01:15,158
Lorem ipsum text...

These above information are in the table. I was able to send post parameters with the download post + get method, but how do I send the table data like in the above position?

Thx for looking into this.

My javascript code:

TableTools.BUTTONS.download = {
"sAction": "text",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "
",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
"sButtonText": "Opslaan",
"mColumns": [ 0, 1, 2,4 ],
"bHeader": false,
"bFooter": false,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
var aoPost = [
{ "name": "naam", "value": "<?php echo $naam; ?>" }
];
var aoPost = [
{ "name": "data", "value": aoData }
];
var aoGet = [];

/* Create an IFrame to do the request */
nIFrame = document.createElement('iframe');
nIFrame.setAttribute( 'id', 'RemotingIFrame' );
nIFrame.style.border='0px';
nIFrame.style.width='0px';
nIFrame.style.height='0px';

document.body.appendChild( nIFrame );
var nContentWindow = nIFrame.contentWindow;
nContentWindow.document.open();
nContentWindow.document.close();

var nForm = nContentWindow.document.createElement( 'form' );
nForm.setAttribute( 'method', 'post' );

/* Add POST data */
for ( var i=0 ; i

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can use the fnGetTableData ( http://datatables.net/extras/tabletools/api#fnGetTableData ) tog et the data from the table, based on the TableTools configuration.

    Allan
  • SeDoSeDo Posts: 8Questions: 0Answers: 0
    Ok,

    How do I use fnGetTableData in a value?
    { "name": "data", "value": fnGetTableData(this doesnt work. I know, just pointing out) }
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Its an API method - you need to call it against the TableTools instance. Have a look at my example in the link above. Another option is to use fnGetInstance - see the same page for the documentation on fnGetInstance.

    Allan
  • SeDoSeDo Posts: 8Questions: 0Answers: 0
    Allan, I don't get it. Could you put a example with my code. Thx.
    And is it possible to post 2 columns like this:
    Column1 --> Column2

    SeDo
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > Could you put a example with my code

    Certainly - if you could pick up an hour of DataTables support ( http://datatables.net/support ) I'd be most happy to create a working example and explain it in detail.

    Allan
This discussion has been closed.