Single Row Select / Row acts as button

Single Row Select / Row acts as button

rhwillsrhwills Posts: 1Questions: 0Answers: 0
edited May 2013 in General
Thanks for a great product.
I want to have a user click act like a submit button, with the selected row number being returned.
Similar to the single-row select example - but with the server receiving an input.
I'm new to jquery etc - an example of this would be a great help to me,
and likely to others.
Thanks -

Replies

  • rhwillsrhwills Posts: 1Questions: 0Answers: 0
    This works:
    [code]

    var oTable;
    var giRedraw = false;

    $(document).ready(function() {
    /* Add a click handler to the rows */
    $("#example tbody").click(function(event) {
    $(oTable.fnSettings().aoData).each(function (){
    $(this.nTr).removeClass('row_selected');
    });
    $(event.target.parentNode).addClass('row_selected');
    var data = oTable._('.row_selected');
    var rw=data[0];
    var cell2=rw[1];
    //alert( "Data:"+cell2 );
    submitform(cell2)
    });

    /* Init the table */
    oTable = $('#example').dataTable( {
    //"bStateSave": true
    });
    } );

    // Submit function
    function submitform(CIDN) {
    document.getElementById("CIDN").value=CIDN
    document.myform.submit();
    }





    DataTables row select example




    XSearchX

    [/code]
This discussion has been closed.