Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81685

Datatable updating Entity through Ajax

$
0
0
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". [] []

Viewing all articles
Browse latest Browse all 81685

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>