Requestend funcion response type out put is create instead of edit

4 posts, 0 answers
  1. Bajivali
    Bajivali avatar
    10 posts
    Member since:
    Oct 2015

    Posted 12 Aug Link to this post

    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

     

     

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 16 Aug Link to this post

    Hi Bajivali,

    When you update an item, the type in the requestEnd arguments should be "update" and not create and the behavior that you are observing is rather strange. Could you please open a regular support ticket and attach a sample, runnable project replicating the issue, so we can test it locally and see if we can pinpoint the root of the problem.

    Additionally, you can provide some additional information on the changes that you have made between the working version (where the type was "update") and the non working one.


    Best Regards,
    Konstantin Dikov
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Bajivali
    Bajivali avatar
    10 posts
    Member since:
    Oct 2015

    Posted 16 Aug Link to this post

    Hi Dikov,

    my project size is beyond 20 mb and i cannot upload my project.

    moreover i use sql server as db engine with ef6.

  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 17 Aug Link to this post

    Hi Bajivali,

    You can strip down the project to contain only the problematic Grid and remove the Kendo.MVC DLL files, so the project's size could be reduced. As for the db, you can replace it with dummy data (a simple collection of items).

    On a side note, could you please elaborate if the editing works correctly on a db level or the issue is just with the type value?
      

    Regards,
    Konstantin Dikov
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready