代码点火器:一次更新所有行。只有一些更新

时间:2018-08-27 05:04:30

标签: ajax database codeigniter model-view-controller datatable

我正在使用CodeIgniter,这发生在我正在创建的系统上。我还是这个新手。当我一次更新所有行时,只有一部分被更新。我不知道它是我的数据表还是控制器中的错误。请帮忙。

这是我的模特:

id

我的js数据表:

public function save_reconciliation($ledger, $product, $reconciliation){
    $this->db->insert_batch('csrproduct_ledger', $ledger);
    foreach ($product as $key => $value) {
        $this->db->where('itemNum', $value['itemNum'])->update('csrproducts', $product);
    }
    $this->db->insert_batch('csrreconciliation', $reconciliation);
}

这是我的控制器代码:

        var table = $('#table').DataTable({
     "bJQueryUI": true,
      "bProcessing": true,
       "processing": true,

"bDeferRender": true,

        ajax: window_location+'/htdocs/reconciliation_items1',
        columns: [

                    {
                        mRender: function(row, setting, full){
                            return "<input type='hidden' name='unitPrice[]' value='"+full.unitPrice+"'>"+"<input type='hidden' name='itemNum[]' value='"+full.itemNum+"'>"+
                                    "<input type='hidden' name='ph_id[]' value='"+full.ph_id+"'>"+full.prodName;
                        }
                    },
                    {
                        mRender: function(row, setting, full){
                            return full.prodQty + ' units';
                        }
                    },
                    {
                        mRender: function(row, setting, full){
                            return "<input name='physical_count[]' type='number' min='0' step='1' class='physical_count' >" +
                                "<input name='status[]' type='hidden'>" +
                                "<input name='computed[]' type='hidden'>" +
                                "<input name='initial[]' type='hidden' value='"+full.prodQty+"'>";
                        }
                    },
                    {
                        mRender: function(row, setting, full){
                            return "<label class='status'></label>";
                        }
                    },
                    {
                        mRender: function(row, setting, full){
                            return "<textarea name='remarks[]' class='remarks'></textarea>";
                        }
                    }
                ],
        scrollX: true,
        columnDefs: [{targets: 0, width: '100px'}, {targets: [1,2,3,4], width: '50px'}],
        ordering: false,
        bPaginate: false,
        language: {
            info: 'Total number of products: <b> _MAX_ </b>',
            infoEmpty: 'Total number of products: <b> 0 </b>'
        }
    });

My system looks like this

0 个答案:

没有答案