DT 10.1 - Getting Row Values

DT 10.1 - Getting Row Values

deliatordeliator Posts: 95Questions: 1Answers: 0

Hello,

The display of the table works fine but row clic (var var_id = (data[Object.keys(obj)[0]]); ) returns me the wrong id ...

            $(document).ready(function() {
                $('.dataTable').DataTable( {
                processing: true,
                serverSide: true,
                ajax: {
                    url: 'data.cfm',
                    dataSrc: 'persons'
                },                      
                dom: 'Bfrtip',      
                select: 'single',
                order: [[ 0, "asc" ]],
                buttons: true,
                buttons: [
                        {
                        extend: 'selectedSingle',
                        className: "btn btn-primary sButtonClass",
                        text: '<i class="fa fa-info-circle"></i> Modifier',
                        action: function ( e, dt, button, config ) {
                        var obj = dt.row( { selected: true } ).data();
                        var var_id = (data[Object.keys(obj)[0]]); 
                        BootstrapDialog.show({
                            title: 'Modification ID ' + var_id,
                                size: BootstrapDialog.SIZE_WIDE,
                                message: $('<div>Test</div>').load('remote.cfm?id=' + var_id )
                            });
                        }
                    },                      
                ],
                } );
            });

Any ideas ?

Thanks

Replies

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    I don't see what data is pointing at line 20 above. Is that a variable that isn't defined, or have I misunderstood.

    Allan

This discussion has been closed.