1
votes

I keep getting this error when I try to update an element from the table in the view in Symfony2:

Cell cannot be updated(Server error)

I'm not sure what the problem is. Is the routing that is incorrect?

The twig(view) file that has the javascript and the table.

the javascript for retrieving data for the table from the controller:

 <script language="JavaScript" type="text/javascript">
    $(document).ready(function () {
        $('#myDataTable').dataTable(

                {
                    "bSort": true,
                    "bFilter": true,
                    "bProcessing": true,
                    "bServerSide": true,
                    "sAjaxSource": "{{ path('CetiucValidateSurveyBundle_renderJson')}}"
                }

        ).makeEditable({

                sUpdateURL: "{{ path('CetiucValidateSurveyBundle_updateChange')}}"


        }
        );




    });
   </script>

The method in the controller that updates de entity(it is simplified in this example, it only retrieves the data from the request).

public function updateChangeAction(Request $request)
{

    $id = $_REQUEST['id'] ;
    $value = $_REQUEST['value'] ;
    $column = $_REQUEST['columnName'] ;
    $columnPosition = $_REQUEST['columnPosition'] ;
    $columnId = $_REQUEST['columnId'] ;
    $rowId = $_REQUEST['rowId'] ;


return $value;
}

This is the routing entry for the the update action

CetiucValidateSurveyBundle_updateChange:
    defaults: { _controller: "CetiucValidateSurveyBundle:Validate:updateChangeAction", _format: json }
    pattern:   /update
    requirements: { _format: (json), _method: POST }

Here is the log that is written when I call the update method, I haven't found anything useful for my problem:

[2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onKernelRequest". [] [] [2012-10-16 03:25:55] request.INFO: Matched route "CetiucValidateSurveyBundle_renderJson" (parameters: "_controller": "Cetiuc\Bundle\ValidateSurveyBundle\Controller\ValidateController::renderJsonAction", "_route": "CetiucValidateSurveyBundle_renderJson") [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector::onKernelController". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.controller" to listener "JMS\SecurityExtraBundle\Controller\ControllerListener::onCoreController". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\Security\Http\Firewall\ContextListener::onKernelResponse". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\SecurityBundle\EventListener\ResponseListener::onKernelResponse". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\CacheListener::onKernelResponse". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse". [] [] [2012-10-16 03:25:55] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse". [] []

1
Why do you keep using bServerSide= true? It is not related to your problem but once again this is not what you needCarlos Granados

1 Answers

-1
votes

Ok thanks to Carlos. I did bit of research and the update function does not require any json functionality.

Since your error is stating Server error it would be very good if you could provide your symfony2 log so that we can identify the server side error.

Either something is wrong with your update method or your routing.