Local inline editing table

Local inline editing table

mikeosoftmikeosoft Posts: 40Questions: 14Answers: 2

Hi,
I am trying to edit a table and submitting the data only at the end of all the rows changes. So I will fire a custom script of my own when I'm ready to submit. However, when I press Enter after a field change, the DataTable tries to submit the data and fails because object "extender" is undefined.

What's wrong, and what to do to resolves this?

Thank you!

VM1023 bundle.js.php:5937 Uncaught TypeError: extender is not a function
at Object.<anonymous> (VM1023 bundle.js.php:5937)
at Function.each (VM1023 bundle.js.php:4)
at Editor._submitTable (VM1023 bundle.js.php:5929)
at Editor._submit (VM1023 bundle.js.php:5887)
at send (VM1023 bundle.js.php:3996)
at Editor.submit (VM1023 bundle.js.php:4018)
at HTMLDocument.<anonymous> (VM1023 bundle.js.php:5417)
at HTMLDocument.dispatch (VM1023 bundle.js.php:4)
at HTMLDocument.y.handle (VM1023 bundle.js.php:4)
(anonymous) @ VM1023 bundle.js.php:5937
each @ VM1023 bundle.js.php:4
Editor._submitTable @ VM1023 bundle.js.php:5929
Editor._submit @ VM1023 bundle.js.php:5887
send @ VM1023 bundle.js.php:3996
Editor.submit @ VM1023 bundle.js.php:4018
(anonymous) @ VM1023 bundle.js.php:5417
dispatch @ VM1023 bundle.js.php:4
y.handle @ VM1023 bundle.js.php:4

This question has an accepted answers - jump to answer

Answers

  • Bindrid2Bindrid2 Posts: 79Questions: 4Answers: 12

    is ajax defined in your Editor?

    I too, only submit when all the rows are edited and the user hits the save button so I left (as suggested somewhere in these pages) ajax blank and it will not submit.

  • mikeosoftmikeosoft Posts: 40Questions: 14Answers: 2
    edited July 2018

    No I did not defined ajax property.
    Here is my configuration :
    (I know the error in the "Fournisseur" field. I will correct that later)

     var editor;
        editor = new $.fn.dataTable.Editor( {           
            table: "#{tabId}table",
            data: <?php echo $myJSON; ?>,
            idSrc:  'id',
            keys: true,
            select: true,
            fields: [ 
                {
                    label: "No Facture",
                    name: "noFacture"
                }, 
                {
                    label: "Fournisseur",
                    name: "Fournisseur.nomFournisseur"
                }, 
                {
                    label: "Date Facture",
                    name: "dateFacture"
                }, 
                {
                    label: "No Compte",
                    name: "noCompte"
                }, 
                {
                    label: "Montant Total",
                    name: "montantTotal"
                }
            ]
        } );
    
        // Activate an inline edit on click of a table cell
        $('#{tabId}table').on( 'click', 'tbody td', function (e) {
            //console.log(this);
            editor.inline( this );
        } );
    
        $('#{tabId}table').DataTable( {
            //ajax: "/svc/rh/compteDepenses.php",
            data: <?php echo $myJSON; ?>,
            keys: true,
            select: true,
            columns: [
                { data: "noFacture" },
                { data: "Fournisseur.nomFournisseur" },
                { data: "dateFacture" },
                { data: "noCompte" },
                { data: "montantTotal" }
            ]
        } );
    
  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    You need to update your DataTables version. There was a bug in previous versions of Editor, the fix for which needed a little change in both Editor and DataTables. If you update to the latest DataTables will will be resolved.

    Allan

  • mikeosoftmikeosoft Posts: 40Questions: 14Answers: 2

    Great, thank you!

This discussion has been closed.