I have a Datatable with form inputs.
This is how I create it
public function getpurchasedata(Request $request)
{
if($request->get('orderID')){
$id = $request->orderID;
$orderNo = PurchaseOrder::find($id);
$order_items = PurchaseOrderItem::where('order_id',$orderNo->order_id)
->with('material')->get();
return DataTables::of($order_items)
->addColumn('name',function($order_items){
$name = $order_items->material;
return $name['name'];
})->addColumn ('expdate',function($order_items){
return '<input type ="date" id="expdate"
name="expdate" class="form-control">';
})->addColumn('action', function ($order_items) {
$buttons ='<button id="edit"
class="btn btn-info btn-sm">
<i class="far fa-edit"></i>
</button>
<button id="remove"
class="btn btn-danger btn-sm">
<i class="far fa-trash-alt"></i>
</button>';
return $buttons;
})->rawColumns(['expdate','action'])->make(true);
}
}
I use the following method to pass Data table values to the controller
grn_tableData:grn_table.data().toArray(),
but when i submit data using an ajax function i get html markups instead on input values for the expdate column. how can i get the real value ? explain me
You can add a hidden column next to your expdate
column. Doing this, you can get the real value after form submission.