Editor/row reorder error for postEdit function

Editor/row reorder error for postEdit function

crush123crush123 Posts: 417Questions: 126Answers: 18

I have an image gallery which uses datatables editor and ajax for image upload/edit.

The gallery editor makes use of the row reorder extension for datatables

On the ajax page, I have added a ‘create thumbnail’ function to fire on postCreate and postEdit which automatically creates a low res image thumb to my images folder.

This is working ok, but I have discovered that when I click and drag a row to reorder, I get network errors, caused by the fact that my postedit function does not have the input values I need, and can’t work out how to resolve this.

http://test3.forthwebsolutions.com/vanilla_images.php?GalleryID=6

Grateful for any pointers

Answers

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited June 2016

    Daft question in retrospect.

    Within my postEdit function, i just used the console to find what was being returned in the data object.
    In the case of a re-order, the only value returned is the order, so i just added some conditional php to the function to only run the create thumbnail function if the image url is in the data

    eg

     ->on('postEdit', function ($editor, $id, $values, $row){
     $inarray = array_key_exists('ImageURL', $values['tblgalleryimages']);
         if ($inarray) {
          run the function
           ....
         }
    }
    
This discussion has been closed.