JQGrid Serialize Data Before Post To Server

I have jqgrid with inline editing. I have date column with format d.m.Y. I want that column to be modified before send to server in format Y-m-d because model binder bind the same property as null if I set format to in jqgrid d.m.Y. What to do to serialize data before request to the server ?

When in edit inline mode i have event for post data:

   $(obj.grid).jqGrid('saveRow', eRowId, {
     succesfunc: function (response) {
     alert("success");
      },
     url: ddf.DDF+ "/Home/Edit",
     mtype: "POST"
   });

Answers


First of all it's important to mention that one should distinguish between the format of internal data, or the data transferred between the server and the client, from the data displayed to the user. jqGrid have the concept of formattres, which allows to generate formatted HTML fragment which will be placed on the <td> cells of the column. There are exist formatter: "date" which can be used to convert input data to some other format. If you would follow the logic of formatters then you would fill the grid with data in the format Y-m-d, but display the data in the format d.m.Y. It formatoptions of the formatter: "date" not contains sendFormatted: true property then jqGrid will automatically convert the results of editing in the source format Y-m-d. Thus you will don't need to make any additional serialization.

Nevertheless, if you do need to make some manual serialization for inline editing, then you should define serializeRowData callback of the level of jqGrid options. The callback get postData object as the only parameters and it should return either the object or the string which will be used to send data to the server.


Need Your Help

Calculations with PyMongo

python mongodb pymongo

I need to make a calculation based on MongoDB data. I tried looking at the API and I can't figure it out. For simplicity's sake, lets say that I want to take two variables (a &amp; b) taken from a

job is running but sidekiq queue is empty

ruby-on-rails-3 sidekiq

I am trying to figure out how I can access the status of the background job using sidekiq.