Django

JqGrid inline editing integration with DJango send csrf token

3 Apr , 2015  

Here is a quick snippet to send csrf_token in POST data from inline edit JqGrid to Django:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var tableGrid = $(selector).jqGrid({
   ....
   onSelectRow: function(id){
         if(id && id!==lastSel){
            $(selector).restoreRow(lastSel);
            lastSel=id;
         }

         var editparameters = {
            extraparam: {csrfmiddlewaretoken: $('.token-data').data('token')},
            keys: true,
          };
         $(selector).jqGrid('editRow', id, editparameters);

    }
};


Leave a Reply

Your email address will not be published. Required fields are marked *