locked
edit button RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below code for Edit button . When i click it does not call getbyId

      columns: [
    { 'data': 'No' },
    { 'data': 'Description' },
    {
    "render": function (data, type, full, meta) {
    return '<a class="btn btn-warning" onClick="getbyID(' + full.No + '\')" href="#">Edit</a>';
    }

    }]

    function getbyID(Id) {
    alert('Hello');

    }

    Thanks

    Sunday, July 29, 2018 5:54 AM

Answers

  • User-1499457942 posted

    Hi

      Resolved 

    {
    "mRender": function (data, type, row) {
    return '<a class="btn btn-warning" onClick="getbyID(' + row[0] + ')" href="#">Edit</a>';
    }

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 29, 2018 8:49 AM

All replies

  • User-1171043462 posted

    Refer

        $(document).on('click', '#data-tableid tbody tr', function() {       
        $("#modalpopupid").modal("show");    
        });

    Ref: https://therichpost.com/how-to-open-bootstrap-modal-popup-on-datatables-tr-click

    Sunday, July 29, 2018 7:44 AM
  • User-1499457942 posted

    Hi

      If i want to open modal on click of Edit Button then what  i need to change

    Thanks

    Sunday, July 29, 2018 8:10 AM
  • User-1171043462 posted

    In the getbyIDfunction

    Write

    function getbyID(Id) {
    $
    ("#modalpopupid").modal("show");
    }
    Sunday, July 29, 2018 8:22 AM
  • User-1499457942 posted

    Hi

     How i should call the getbyId function in the below line

    Thanks

    Sunday, July 29, 2018 8:25 AM
  • User-1171043462 posted

    return '<a class="btn btn-warning" onClick="getbyID(' + full.No + '\')" href="#">Edit</a>'

    You have already called here onClick event

    Sunday, July 29, 2018 8:29 AM
  • User-1499457942 posted

    Hi

      When i click i get error - Uncaught ReferenceError: gggg is not defined . gggg is the value in first column

    {
    "render": function (data, type, full, meta) {
    return '<a class="btn btn-warning" onClick="getbyID(' + full.No + ')" href="#">Edit</a>';
    }

    Thanks

    Sunday, July 29, 2018 8:35 AM
  • User-1499457942 posted

    Hi

      Resolved 

    {
    "mRender": function (data, type, row) {
    return '<a class="btn btn-warning" onClick="getbyID(' + row[0] + ')" href="#">Edit</a>';
    }

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 29, 2018 8:49 AM