how to get selected data on inline button ?

how to get selected data on inline button ?

mm789000mm789000 Posts: 21Questions: 2Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Hi,

I try to get selected data on the inline button like this , but does not wrok !

// Edit record
$('#my_table').on('click', 'td.editor-edit', function (e) {
    e.preventDefault();

            var count = table.rows( { selected: true } ).count();

             alert('count = '+count);

} );

Thanks.
Mikael

Replies

  • kthorngrenkthorngren Posts: 15,760Questions: 25Answers: 3,736

    but does not wrok !

    What exactly happens?

    Are you using the Select extension? If not the { selected: true } won't work.

    Please provide a link to your page are a running test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • mm789000mm789000 Posts: 21Questions: 2Answers: 0

    Nothing happen.
    Yes select extension is set.

  • mm789000mm789000 Posts: 21Questions: 2Answers: 0
    $('#my_table').DataTable( {
        ajax: "../controllers/my_table.php",
        columns: [
         { data: "id" },            
            { data: "date" },           
            {
                data: null, 
                className: "dt-center editor-edit",
                defaultContent: '<i class="fa fa-pencil-alt"/>',
                orderable: false
            },
            {
                data: null, 
                className: "dt-center editor-delete",
                defaultContent: '<i class="fa fa-trash"/>',
                orderable: false
            },
            {
                data: null, 
                className: "dt-center editor-print",
                defaultContent: '<i class="fa fa-print"/>',
                orderable: false
            }
    
        ],
        select: true
    } );
    
  • colincolin Posts: 14,185Questions: 1Answers: 2,404

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 15,760Questions: 25Answers: 3,736

    Nothing happen

    You don't see the alert message?

    I built a test case for you.
    http://live.datatables.net/vecodire/1/edit

    The event works but the problem is it is fired before the row is selected. I added a couple lines to show how to get the row data. Is this what you are wanting?

    Kevin

  • mm789000mm789000 Posts: 21Questions: 2Answers: 0

    Thanks it work !

Sign In or Register to comment.