Don't remove data on server from Simple inline editing DataTables

Don't remove data on server from Simple inline editing DataTables

ucip3ucip3 Posts: 4Questions: 2Answers: 0

In the simple inline editing, the delete button remove the checked row in de UI but don't remove the data on server.

However, other events work well: create new data and modifies them without problem, but when I delete a row and refresh the web, these data reappear again.

The code is pasted and copied from the official website, as in the example.

What is the solution?
What I have wrong?

Thank you.

Replies

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    Hi,

    Unfortunately this is a bug in Editor 1.4.1. In the Editor.php file you will find a method called _remove_table. It should look like this:

        function _remove_table ( $table, $ids, $pkey=null )
        {
            if ( $pkey === null ) {
                $pkey = $this->_pkey;
            }
    
            // Check there is a field which has a set option for this table
            $count = 0;
    
            foreach ($this->_fields as $field) {
                if ( strpos( $field->dbField(), '.') === false || (
                        $this->_part( $field->dbField(), 'table' ) === $table &&
                        $field->set() !== Field::SET_NONE
                    )
                ) {
                    $count++;
                }
            }
    
            if ( $count > 0 ) {
                $this->_db
                    ->query( 'delete' )
                    ->table( $table )
                    ->or_where( $pkey, $ids )
                    ->exec();
            }
        }
    

    If you replace the existing method with the above in your code it will start working as expected.

    I will release Editor 1.4.2 with the fix within the next few days.

    Thanks for flagging this up!

    Allan

  • ucip3ucip3 Posts: 4Questions: 2Answers: 0
    edited April 2015

    Allan, thank you very much for answering so quickly to my post, works perfectly!!

This discussion has been closed.