Reputation: 9
dxDataGrid: How can I call Ajax inside setCellValue()
. My goal is that after changing the value of a cell, I will call Ajax again to get the value and reset it for other cells.
but it didn't work!! response value was returned but newData was not implemented
I have done it as follows:
setCellValue: function(newData, value, currentRowData) {
newData.supplies = value;
let dataSupp = value.split(' &*& ');
newData.supplies_code = dataSupp[0]
newData.supplies_unit = dataSupp[2]
let sales = $('#sales').val();
let expected_revenue = $('#expected_revenue').val();
let order_use_from = $('#order_use_from').val();
let order_use_to = $('#order_use_to').val();
$.ajax({
type: 'POST',
url: "{{ route('admin.shopping-request.per-mil') }}",
data: {
sales: sales,
expected_revenue: expected_revenue,
order_use_from: order_use_from,
order_use_to: order_use_to,
dataSupp: dataSupp
},
success: function(response) {
console.log(response);
newData.per_mil = response;
}
});
}
I expect new data to be set when the Ajax is done. Can someone tell me a reasonable solution? Thank you everyone for your interest
Upvotes: 0
Views: 189