Editor Not Saving When "Enter" is Pressed

Editor Not Saving When "Enter" is Pressed

aallardaallard Posts: 2Questions: 2Answers: 0
edited December 2014 in Free community support

Hey all...

I have a table defined on a web page like:

        var editor;

        $(document).ready(function() {

           editor = new $.fn.dataTable.Editor( {
                ajax: "scripts/certifications2.php",
                table: "#certifications",
                fields: [ {
                    name: "UserCertAssoc.UserCertNbr"
                }, {
                    name: "UserCertificateType.UserCertificateTitle"
                }, {
                    name: "UserCertAssoc.CertExperationDate"
                }, {
                    name: "UserCertAssoc.UserCertOrganization"
                }, {
                    name: "UserCertAssoc.UserCertDesc"
                }, {
                    name: "User.UserID"
                }, {
                    name: "User.UserName"
                }, {
                    name: "UserCertAssoc.UserCertAssocID"
                }, {
                    name: "UserCertificateType.UserCertificateTypeID"
                }
                ]
            } );


            $('#certifications').on( 'click', 'tbody td:not(:first-child)', function (e) {
                editor.inline( this );
            } );


            $('#certifications').dataTable( {
                dom: "Tfrtip",
                ajax: {
                    url: "scripts/certifications2.php",
                    type: 'POST'
                },
                columns: [
                    { data: "UserCertAssoc.UserCertNbr" },
                    { data: "UserCertificateType.UserCertificateTitle" },
                    { data: "UserCertAssoc.CertExperationDate" },
                    { data: "UserCertAssoc.UserCertOrganization" },
                    { data: "UserCertAssoc.UserCertDesc" },
                    { data: "User.UserID", "targets": [ 5 ], "visible": false, "searchable": false},
                    { data: "User.UserName", "targets": [ 6 ], "visible": false, "searchable": false},
                    { data: "UserCertAssoc.UserCertAssocID", "targets": [ 7 ], "visible": false, "searchable": false},
                    { data: "UserCertificateType.UserCertificateTypeID", "targets": [ 8 ], "visible": false, "searchable": false }
                ],
                tableTools: {
                    sRowSelect: "os",
                    sRowSelector: 'td:first-child',
                    aButtons: [
                        { sExtends: "editor_create", editor: editor },
                        { sExtends: "editor_edit",   editor: editor },
                        { sExtends: "editor_remove", editor: editor }
                    ]
                }


            } );


        } );

And the Server-side looks like this:

<?php


include( "../extensions/Editor-1.3.3/php/DataTables.php" );

use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Join,
    DataTables\Editor\Validate;


Editor::inst( $db, 'User' )
    ->field(
        Field::inst( 'UserCertificateType.UserCertificateTitle' ),
        Field::inst( 'UserCertAssoc.CertExperationDate' ),
        Field::inst( 'UserCertAssoc.UserCertNbr' ),
        Field::inst( 'UserCertAssoc.UserCertOrganization' ),
        Field::inst( 'UserCertAssoc.UserCertDesc' ),
        Field::inst( 'User.UserID' ),
        Field::inst( 'User.UserName' ),
        Field::inst( 'UserCertAssoc.UserCertAssocID' ),
        Field::inst( 'UserCertificateType.UserCertificateTypeID' )
    )
    ->pkey( 'UserID' )
    ->leftJoin( 'UserCertAssoc', 'UserCertAssoc.UserID', '=', 'User.UserID' )
    ->leftJoin( 'UserCertificateType', 'UserCertAssoc.UserCertTypeID', '=', 'UserCertificateType.UserCertificateTypeID' )
    ->where($key = 'User.UserID', $value = '3', $op = '=' )
    ->process($_POST)
    ->json();

This all works beautifully, except...

When I edit a cell on the table, the edits are never saved. Pressing "Enter" when finished editing does nothing.

Is there something I'm missing?

Thanks!

Answers

  • allanallan Posts: 63,530Questions: 1Answers: 10,473 Site admin

    Hi,

    Are you able to link to the page in question so I can debug it please? What you have above looks fine to me!

    The other thing to check would be to look at the error console in your browser - are any errors being reported?

    Allan

This discussion has been closed.