Export function called programmatically? Or the ability to do things prior to the export function.

Export function called programmatically? Or the ability to do things prior to the export function.

mrd05dmrd05d Posts: 45Questions: 6Answers: 3

I may have missed it but is there an api function for calling the flash export pieces without it being directly tied to the button itself?

I would like to on press of the tabletools button to do the following:

  • Custom filter
  • Then call the export function on the table (only exporting the rows obeying the custom filter)
  • Ajax Call to manipulate database to insert exported data to a new table in the db
  • Location reload to reload the page (or just an ajax.reload maybe)

Is this possible?

Answers

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    Oh geez please delete this. Of course the first thing I do after posting is run across the needed information in the documentation.

    SMH

    My Appologies

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    Actually I am still not one hundred percent understanding how this would be accomplished...

    I would think i would set up the button to use the flash_save action and then by the looks of it fnCellRender is the only one that fires prior to the action?

    If this is true can i redraw a table prior to the export ? Or is there a better way

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    So after some digging and trial and error i have come up with the following although i have not put in the ajax call or reload yet:

    {
        "sExtends": "xls",
        "sButtonText": "Daily Export",
        "oSelectorOpts": {
            "page": 'all',
            "filter": 'applied',
            "mColumns": "visible"
        },
        "fnClick": function(nButton, oConfig, flash) {
    
                 table
                .columns(10)
                .search('^[0-9]*/[0-9]*/[0-9]*', true, false, true)
                .draw();
    
    
            this.fnSetText(flash, this.fnGetTableData(oConfig));
    
    
        }
    }
    
This discussion has been closed.