Row reordering where the ajax data source has left join
Row reordering where the ajax data source has left join
I am using row reordering without any issues where i have a single table in the ajax source, but I get an error thrown on preCreate and postRemove if there is a left join.
I tried specifying the table in the code but get the error Notice: Undefined index: refgallery.ListOrder in filename.php on line 41
->on( 'preCreate', function ( $editor, $values ) {
// On create update all the other records to make room for our new one
$editor->db()
->query( 'update', 'refgallery' )
->set( 'refgallery.ListOrder', 'refgallery.ListOrder+1', false )
->where( 'refgallery.ListOrder', $values['refgallery.ListOrder'], '>=' )
->exec();
} )
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Have you set Editor up to submit all values (
form-options
- see thesubmit
option)? If not, then it is only going to submit the values which have a new value, which might explain the issue. If not that, then can you link to a test case please.Allan
..unless its my syntax
i have tried this with a table, no left join, but declaring the table name into the editor instance
eg the following code works...
but this code throws the error, as described earlier
Ah - I see the issue - thanks for the link by PM.
The issue is with how the parameter is being accessed:
It should actually be:
i.e. it is really a dimensional array.
You could add
print_r( $values )
if you wanted to see the full data structure.Allan
thanks Allan, - my syntax again !
Love this plug in.
Thnx, solved also my problem
Thnx, solved also my problem