Is it possible to register an event handler for fnClick()?

Is it possible to register an event handler for fnClick()?

bitDoctorbitDoctor Posts: 9Questions: 1Answers: 0

I am developing an SPA and would prefer not to have fnClick call a function to create and populate a new tab due to scoping issues in my application. I would prefer to register a JavaScript event handler for the fnClick for my sButtonText. Does anyone know if that is possible?

Thanks!

bD

Answers

  • bitDoctorbitDoctor Posts: 9Questions: 1Answers: 0

    Maybe I should backup a bit. I am simply looking for a way to implement a button on a single row select table which, when the button is clicked, calls my JavaScript function. I don't want to extend any of the existing buttons (e.g. print, copy, etc) from what I can tell.

    I simply want to call my function and pass the selected row data into it. Here is my current configuration:

    oTableTools: {
        "sRowSelect": "single",
        "aButtons": [{
            "sExtends":    "select_single",
            "sButtonText": "Analyze selected well",
            "fnClick": function ( nButton, oConfig, oFlash ) {
                var row_data = this.fnGetSelectedData()[0][0];
                plotProductionLineChart (row_data);
            }
        }]
    }
    

    However, I receive an "Uncaught TypeError: undefined is not a function" when this line is executed

    oConfig.fnClick.call( that, nButton, oConfig, null, e );

    in the oConfig Button configuration object. Am I making this more complicated than I should?

This discussion has been closed.