Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Hot to access the data of the first cell for a button url paramater

$
0
0

I'm trying to create a button action that passes the data of the first cell as a URL variable for row (id). After updating to 1.10 the original code is failing...

ORIGINAL CODE:

fnClick: function ( button, config ) {
                    var data = this.fnGetSelectedData();
                    if ( ! data.length ) {
                      return;
                    }
                    window.location.assign('index.cfm?pf=1&cid=<cfoutput>#VARIABLES.cid#</cfoutput>&wid='+data[0].id);
                  }

NEW CODE (Failing to pass Row ID):

var table = $('#form').DataTable( {
        dom: "Bfrtip",
        ajax: "/report_modules/training/act/trainingtypes.php",
        rowId: "id",
        columns: [
            { data: "id" },
            { data: "training_type" },
            { data: "training_desc" }
        ],
        select: true,
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor },
            {
                extend: "selectedSingle",
                text: "View Detail"
           }
        ]
    } );
    $("#form").on('click', '.buttons-selected-single', function() {
    alert('Row index: ' + $(this).closest('tr').index());
    });

Viewing all articles
Browse latest Browse all 2364

Trending Articles