editor migration from 1.4.2 to 1.5.2
editor migration from 1.4.2 to 1.5.2
I am continuing to develop a site which has been using datatables since 1.9.4 and editor since 1.3, and am now trying to consolidate the site and remove the older libraries.
I have some working pages using 1.4.2 which throw errors if i change to 1.5.2. can i ask
is it advisable to update and if so, is there a migration document I should be following ?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
For Editor you can look at https://editor.datatables.net/upgrade/1.5/ . I'm not sure what version of DT Editor 1.5.X needs, though.
Editor 1.5 requires at least DataTables 1.10.7 - although the latest release is always recommended.
What are the errors you are seeing with 1.5?
Allan
Thanks Both
On my ajax page, i am interecepting a value posted by the editor.
the syntax for 1.4.2 is
and i get the error Undefined index: members in...
I think the issue is down to the fact that multiple edits are now possible and I also need to pass in the row id, but haven't yet worked out how
i just tried
I also tried adding the legacyajax command to my page, but this didn't fix the issue
You can use the
legacyAjax
option if you want Editor to use the old style. You noted it didn't work, but not what the error was that made it not work.However, if you have the time to, updating to the new style will hopefully be beneficial in the long term.
Allan
Using legacyAjax produced the correct headers, but preview and response are empty !?
I would prefer to move to the new style, but can't easily recover the row id of the currently edited row. - I want to return
$_POST['data']['DT_RowId']['members']['MembershipExpiresEnd']
The only way i have managed to do this is
it seems to work, but looks a bit clumsy.
So far then, i have managed to edit the ajax page to work with editor 1.5.2, and it causes no problem with create and edit.
However i do get a problem with delete.
The delete part works ok, but I have a submitSuccess event which throws an error on delete, which (i think) worked ok before - 'Cannot read property 'contacts' of undefined', presumably because the data returned is an empty array, as the row has just been deleted.
...
Assuming this is the reason, i can add a condition to this block to check if the data is undefined ?
Ah - you are using the pre-built libraries? In which case, the ones which comes with 1.5 do not support the legacy format - only the new one. Which would explain that issue.
The method you have used is certainly one option - if you want to work directly with the raw data it is probably the only option. Instead, what I would suggest is that you use server-side events which were introduced in 1.5 to help with exactly this sort of situation. I realise it is a bit more work to update the code to the new style, but if you try it, I think it will be worth it!
Allan
Thanks Allan,
I was a bit hesitant to change to the server side events as the original code I had took me a while to get right, but following the example from your link, I got most of it working pretty quickly.
I find it much easier when I can work to an example, and the one on the server side events page made it a lot easier for me.
Super - that's great to hear!