Editor v1.5.0 requires to know row_# to validate or modify values
Editor v1.5.0 requires to know row_# to validate or modify values
Hello,
I really like most of the new features of Editor and DT. However, my code in JS and PHP stopped working when I try to validate or edit some values. For instance, o.data.users.username
no longer valid. Now, I need to know row_# each time I want to access the value (o.data.users.row_#.username
). The same issue with $_POST['data']['users']['username']
and $_POST['data']['row_#']['users']['username']
. Is there in chance not to deal with row_# at all in Editor v1.5.0?
Thanks,
Tom
This question has accepted answers - jump to:
Answers
Yes, per the upgrade notes you can use the
legacyAjax
option to use the old data interchange format.The format had to be changed to support multi-row editing in 1.5, so enabling the old form will not allow multi-row editing, but it will work exactly how 1.4 worked.
Allan
Thanks Allan. Multi-row is a nice a feature, but not in this case, in all my 50+ tables.
By the way, for the future use, how do I get row_# in PHP, if it is a key in an associative array that I have to know ahead? The same question concerning JS. How do I know row_# when I am in
editor_users.on( 'preSubmit', function ( e, o, action ) {...});
?Thanks in advance
You would need to use a loop. In PHP you would typically use something like
foreach( $_POST['data'] as $key => $values ) { ... }
. In Javascript you would typically use jQuery's$.each()
. You could use native looping over objects, but you need to be careful with browser compatibility.Allan