Laravel modal datatables update -
in view there button called 'add/edit product',when click , input values in qty fields below 'add/edit product' button table created.
my view:
i want change/update data in modal qty value when change in table. did little bit change 1 page in modal:
i used yajra data-table in modal. modal view:
<!-- modal --> <div class="modal fade" id="productmodal" role="dialog"> <div class="modal-dialog prod_dia"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">add /edit product</h4> </div> <div class="modal-body"> <section class="panel panel-primary"> <div class="panel-heading"> <b>add /edit product</b> </div> <div class="panel-body product_body"> <div class="table-responsive maindiv"> <table class="table table-hover table-bordered prdb" id="productid"> <form name="proform"> <thead> <th>product</th> <th>price</th> <th>qty</th> </thead> <tbody> @foreach($datapr $k) <tr> <td>{{$k->brand}}-{{$k->pcode}}-{{$k->pgroup}}<input type="hidden" data-pcode='{{$k->pcode}}' class="qtyforpcode"></td> <td>{{$k->price}}</td> <td> <input type="text" data-prid='{{$k->prid}}' data-brand='{{$k->brand}}' data-price='{{$k->price}}' data-pgroup='{{$k->pgroup}}' data-sprice='{{$k->sprice}}' data-pcode='{{$k->pcode}}' name="pr_qty" id="qty" class="form-control qty"> </td> </tr> @endforeach </tbody> </table> </form> </div> </div> </section> </div> <div class="modal-footer"> <input type="submit" value="done" id="doneproduct" class="btn btn-primary customclose"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </form> </div> </div> </div>
in jquery try update modal(but changes 1 page in modal)
$('.qtypr').on('change',function(){ var ttr=$(this).parent().parent(); var qty=ttr.find('.qtypr').val();//new value var pcode=ttr.find('.qtypr').data('pcode'); console.log(qty); console.log(pcode); $('#productmodal .prod_dia .product_body .maindiv .prdb tr').each(function(){ var pcodetable=$(this).find('.qtyforpcode').data('pcode'); $(this).css("background-color", "yellow"); console.log("--pcodetable -----"); console.log(pcodetable); if(pcodetable==pcode){ console.log("match 1 vale"); $(this).find('td .qty').val(qty); } }); });
what problem because of modal or data table paging? please me, how can update
Comments
Post a Comment