Editor Edit and Delete forms are not unloading after submit

Editor Edit and Delete forms are not unloading after submit

marialpettitmarialpettit Posts: 7Questions: 3Answers: 0

Inline editing works fine, but when I show the Editor forms using Editor.edit() or Editor.delete(), the dialog box shown by Editor will not unload after submission. This is a new problem and appeared only today. What could be causing this?

debug code: afamog

Javascript:

    // Reload the survey tables after removing a device
    eSurveyBuild.on('postRemove', function (e, json)
    {
        dtSurveyInfo.ajax.reload();
        dtSurveySoftware.ajax.reload();
        dtSurveyBuild.ajax.reload();
    });

    // Edit device
    $('#surveyBuild').on('click', 'a.editor_edit', function (e) {
        e.preventDefault();

        eSurveyBuild.edit($(this).closest('tr'), {
            title: 'Edit deployment device',
            buttons: 'Update',
            closeOnComplete: true
        });
    });

    // Delete a device
    $('#surveyBuild').on('click', 'a.editor_remove', function (e) {
        e.preventDefault();

        eSurveyBuild.remove($(this).closest('tr'), {
            title: 'Delete deployment device',
            message: 'Are you sure you want to delete this deployment device?',
            buttons: 'Delete',
            closeOnComplete: true
        });
    });

    // Resurvey a device (cheat: we're really resurveying the whole list)
    $('#surveyBuild').on('click', 'a.editor_resurvey', function (e) 
    {
        e.preventDefault();
        dtSurveyBuild.ajax.reload();
    });


    //*****************************************************
    //*
    //* Activate an inline edit on click of a table cell
    //*
    //*****************************************************
    $('#surveyBuild').on('click', 'tbody td', function (e) {
        var index = $(this).index();

        if ((index > 7) && (index < 14)) {
            eSurveyBuild.inline(this,
            {
                submitOnBlur: true
            });
        }

    });

Controller:
//****************************************************************
//*
//* EditSurveyBuild
//* ---------------
//*
//* Called by DataTable
//*
//****************************************************************
[Route("deployment/EditSurveyBuild")]
public ActionResult EditSurveyBuild(FormCollection fc)
{
String action = fc["action"];
String userID = ViewBag.UserID;

        // there's no way to pass in the deployment ID so we have to get it from TempData
        int deploymentID = Convert.ToInt32(TempData["DeploymentID"]);
        TempData.Keep("DeploymentID");

        if (action == null)
        {
            // get build info
            List<WLCM_DEPLOYMENT_DEVICE> allDevices = eustr_DB.GetDevicesByDeploymentID(deploymentID);
            ext_engineering_DB.GetDeviceMachineBuildInfo(allDevices, deploymentID);
            eustr_DB.UpdateDeviceList(allDevices, userID);
        }

        else if (action == "edit")
        {
            fc["data[MODIFIED_BY]"] = userID;
            fc["data[MODIFIED_DT]"] = DateTime.Now.ToString();
        }

        String sConn = ConfigurationManager.ConnectionStrings["EUSTR_Connection"].ConnectionString;
        var db = new Database("sqlserver", sConn);

        Editor e = new Editor(db, "WLCM_DEPLOYMENT_DEVICE", "DEPLOYMENT_DEVICE_PK");
        e.Model<WLCM_DEPLOYMENT_DEVICE>();
        e.Where("DEPLOYMENT_PK", deploymentID);
        e.Process(fc);
        DtResponse r = e.Data();

        return Json(r, JsonRequestBehavior.AllowGet);


    }

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,814Questions: 1Answers: 10,123 Site admin
    Answer ✓

    The first thing to check will be the Ajax return from the server when this occurs. Using the Network tab in your browser's developer tools - you should be able to see the Ajax request being made when you submit the form and what the server is responding with. Could you show me what that is?

    Thanks,
    Allan

  • marialpettitmarialpettit Posts: 7Questions: 3Answers: 0

    Hi Allan,

    There was no error returned with the Ajax request but there was a 404 error prior caused by ajax-loader.gif not being in the expected Content\Images folder. Once I copied it in there the modal form now closes as expected. Thanks for the tip. That solved the issue.

  • allanallan Posts: 61,814Questions: 1Answers: 10,123 Site admin

    Interesting - I wouldn't have expected a 404 on the processing image to cause that error. Thank for letting me know about this!

    Allan

This discussion has been closed.