robinchalia / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

Add id to sUpdateURL #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've figured out how to alter the HTTP method for updates (add "method": "PUT" 
to column definition in aoColumns). However, I need to be able to append the 
record id to the URL to which the AJAX request is sent. I'm using Rails, so 
updates are send via PUT to "/resource_name/id" (i.e. PUT "/materials/238"). 
I've attempted to alter the sUpdateURL parameter using the fnOnEditing 
function, but this doesn't seem to work.

Is this possible?

Original issue reported on code.google.com by dogenp...@gmail.com on 14 Mar 2012 at 5:24

GoogleCodeExporter commented 9 years ago
Hi,

In the latest version 2.3.1 i have added oEditableSettings as an parameter for 
this function. Now you can change URL in the oEditableSettings.target (see demo 
page http://jquery-datatables-editable.googlecode.com/svn/trunk/events.html).

Let me know whether this helps.

Jovan

Original comment by joc...@gmail.com on 14 Mar 2012 at 10:39

GoogleCodeExporter commented 9 years ago
Thanks! I was on a really old version apparently. This works like a charm!

Original comment by dogenp...@gmail.com on 15 Mar 2012 at 5:22

GoogleCodeExporter commented 9 years ago
So now I have another question. It looks like you're checking for a string in 
the 'response' to the update. In my app, the server returns the updated record 
and sets the HTTP status to 200 "OK".  I'd like to parse the returned record 
and update other cells which are calculated server-side based on the updated 
field value.

It looks as though 'statusString' in the oAjaxSubmitOptions' success callback 
would have the "OK" value and the 'response' has the updated record. If you 
don't mind, I'd be more than happy to work on this and submit a patch or 
something.

Thanks for the quick response by the way! I really appreciate it!

Original comment by dogenp...@gmail.com on 15 Mar 2012 at 7:16

GoogleCodeExporter commented 9 years ago
Hi I'm glad that it helps. If you don;'t mind could you close the issue and if 
you have another question start with another one. this way is easier to track 
them.

Could you use fnOnEdited function because it gets lot of values:

function fnOnEdited(result, sOldValue, sNewValue, iRowIndex, iColumnIndex, 
iRealColumnIndex) 

You can determine other cells based on these argumets and update them using the 
sNewValue.

Jovan

Original comment by joc...@gmail.com on 15 Mar 2012 at 8:31

GoogleCodeExporter commented 9 years ago
Ok, no problem. I'll take a look and open a new issue if needed.

Thanks again!

Original comment by dogenp...@gmail.com on 15 Mar 2012 at 8:34

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
fixed

Original comment by dogenp...@gmail.com on 15 Mar 2012 at 8:39

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 15 Mar 2012 at 8:42