hi , I have a pretty simple requirement for doing that I have written the following code.
grid is in paymentviewgrid cshtml which is being called in the index page, below
function BuGridSaveChange(e)
{
if (manualList.length > 0)
{
var isRecordExist = false;
var totalRecords = manualList;
for (var i = 0; i <= totalRecords.length - 1; i++)
{
if (manualList[i].PoId == e.model.PoId && manualList[i].RCUId == e.model.RCUId && manualList[i].MrrId == e.model.MrrId
&& manualList[i].BU_Id == e.model.BU_Id
&& manualList[i].REUId == e.model.REUId)
{
manualList[i].ManualAmountPaid = e.model.ManualAmountPaid;
isRecordExist = true;
}
}
if (isRecordExist == false)
{
var singleSrObj = new Object();
singleSrObj.PoId = e.model.PoId;
singleSrObj.REUId = e.model.REUId;
singleSrObj.RCUId = e.model.RCUId;
singleSrObj.MrrId = e.model.MrrId;
singleSrObj.ManualAmountPaid = e.model.ManualAmountPaid;
singleSrObj.BU_Id = e.model.BU_Id;
manualList.push(singleSrObj);
}
}
else
{
var singleNewSrObj = new Object();
singleNewSrObj.PoId = e.model.PoId;
singleNewSrObj.REUId = e.model.REUId;
singleNewSrObj.RCUId = e.model.RCUId;
singleNewSrObj.MrrId = e.model.MrrId;
singleNewSrObj.ManualAmountPaid = e.model.ManualAmountPaid;
singleNewSrObj.BU_Id = e.model.BU_Id;
manualList.push(singleNewSrObj);
}
}
function RequestEnd(e)
{
if (e.response.Errors == null )
{
if ((e.type === "update" )&& e.response.Data.length > 0)
{
if (manualList.length > 0)
{
var isAmountEntered = false;
for (var i = 0; i <= manualList.length - 1; i++)
{
if (manualList[i].ManualAmountPaid != null && manualList[i].ManualAmountPaid >= 0)
{
isAmountEntered = true;
}
if (manualList[i].PoId == e.response.Data[0].PoId && manualList[i].RCUId == e.response.Data[0].RCUId && manualList[i].MrrId == e.response.Data[0].MrrId
&& manualList[i].BU_Id == e.response.Data[0].BU_Id
&& manualList[i].REUId == e.response.Data[0].REUId)
{
manualList[i].ManualAmountPaid = e.response.Data[0].ManualAmountPaid;
document.getElementById("approvePaymentButton").disabled = true;
document.getElementById("poSummaryPaymentButton").disabled = true;
}
}
if (isAmountEntered == true)
{
document.getElementById("recreatePaymentButton").disabled = false;
}
else
{
document.getElementById("recreatePaymentButton").disabled = true;
document.getElementById("approvePaymentButton").disabled = false;
document.getElementById("poSummaryPaymentButton").disabled = false;
}
}
}
}
else if (e.response.Errors != null && e.type === "update")
{
document.getElementById("recreatePaymentButton").disabled = true;
}
}
the issue is while coding this
I received e.type== "update " and in update function I have written some other businesslogic
and after testing and implementation with no code changes , I started receiving e.type== "create" where I cannot see update atall.
due to this I cannot call the logic that was in update function from controller.
could you please help on this