Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

55
Views
Passing data to input form inside cell datatable when checkbox selected

I have a checkbox on a table, where when that checkbox is selected it will pass data in the "sisa" variable. When in the console log , I have managed to display the "sisa" data. But how to submit the "sisa" data in the input form in the next column ("diterima" column). This checkbox is a multiple selection, so you can select many at once.

the screenshoot: https://i.postimg.cc/qq7CpVrf/error.png

My datatable

$('#produkTabel').DataTable({
    "aaData": response.result,
    "columns": [

        {
            "data": "id", "class": "text-center",
            render: function (data, type, row, meta) {
                return meta.row + meta.settings._iDisplayStart + 1;
            }
        },
        {"data": "produk.item_code"},
        {"data": "produk.name"},
        {"data": "jumlah", "class": "text-center"},
        {"data": "sisa", "class": "text-center"},
        {"data": "id", "class": "text-center", render: function ( data,row) {
                return '<input type="number"  id="inputID" class="open-input form-control bg-white" value="0">';
            },},
        {
            "data": "id",
            "class": "text-center",
            'searchable': false,
            'orderable': false,
            render: function ( data, type ,row ) {
                if ( type === 'display' ) {
                    return '<input type="checkbox" data-sisa="'+row.sisa+'" class="editor-active">';
                }
                return data;
            },
            className: "dt-body-center"
        },
    ],
    "bDestroy": true,
});

My Jquery

$('body').on('change', 'input[type="checkbox"]', function() {
    // var tblData = table.rows('.selected').data();
    let sisa = $(this).data('sisa');
    // console.log(tblData);
    // var inputForm = $(this).'input[type="number"]';
    // $('.open-input').val(sisa);
    // this.checked ? inputForm.val(sisa) : inputForm.val(0);
    console.log(sisa);
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

$("#inputID").val(sisa);

Try this in your script....sorry if am wrong

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!