Select a cell in table

Select a cell in table

skyscreepaskyscreepa Posts: 1Questions: 1Answers: 0
edited October 2014 in Free community support

Hi , I've read several post about this subject and I find this one : https://datatables.net/forums/discussion/19862/get-value-from-first-cell-in-a-selected-row-using-v1-10-beta-2

I have the exact same problem , except when I do this I have a "undefined" instead of the value of the cell

Here is my code :

<script type="text/javascript">
    $(document).ready(function () {
       var table = $('#example').DataTable({
            paging: false,
            "ajax": {
                "url": "@Url.Action("test","Demandes")",
                "dataSrc": ""
            },
            "columns": [
                { "data": "ID" },
                { "data": "Client" },
                { "data": "TitreDemande" },
                { "data": "Commercial" },
                { "data": "DateDemande" },
                { "data": "Agence" },
                { "data" : ""}
            ],
            "columnDefs": [{
                "targets": -1,
                "data": null,
                "defaultContent": "<button class='btn btn-default'><span class='glyphicon glyphicon-zoom-in'></button>"
            }]
        });
        $('#example tbody').on('click', 'button', function () {
            var data = table.cell('.selected', 0).data()
            alert(data);
        });
    });
</script>

Thanks in advance !

This discussion has been closed.