kaushik guru

kaushik guru

  • 1.4k
  • 252
  • 27.3k

how to add txtbox to jquery datatable and update to rspctive row in db

Apr 23 2023 7:04 PM

Dear team i am new in using datatable i have a datatable where i want to add a textbox for each row and on button click event i want to save it in the db with respective textbox to its particular id 

````
<script>
        $(document).ready(function () {
            var empid = '@ViewBag.empid';
            $.ajax({
                type: "POST",
                dataType: "JSON",
                url: "/HRValidation/LoadInsuranceNominee",
                data: "id=" + empid,
                success: function (response) {
                    console.log(response);
                    $('#insurancetable').dataTable({
                        data: response,
                        columns: [
                            { "data": null, "render": function (data, type, full, meta) { return '<input type="checkbox" name="chkSelect" id="' + full.employeeInsuranceId + '" value="' + full.employeeInsuranceId + '">'; }},
                            { 'data': 'employeeInsuranceId' },
                            { 'data': 'employeeId' },
                            { 'data': 'insurance_Nomiee_Name' },
                            { 'data': 'insurance_Nomiee_Gender_Name' },
                            { 'data': 'insurance_Nomiee_Relationship_Name' },
                            { 'data': 'insurance_Nomiee_DOB_String' },
                            { 'data': 'relationship_Comments' }
                            
                        ],
                        //autofill: true,
                        //select: true,
                        //responsive: true,
                        //destroy: true,
                        //scrollY: true,
                        //scrollX: true,
                    })
                },
                error: function (error) {
                    console.log(response);
                }

            });

        });


    </script>
````

this is my datatable 
i am struck after this part any help will be appreciated


Answers (4)