post... and submit... editor events never reached

post... and submit... editor events never reached

LicassLicass Posts: 6Questions: 2Answers: 0

I need help on why these events ex:postSubmit and submitComplete never fired besides correct data is returned by server.
duplicated requests is the problem. Here a link http://www.quad-systems.pt/QUAD_HCM/#ajax/datatablePROTO.php

maybe because of
ajax: function (data, callback, settings) {
var dat = JSON.parse(myTableName.getData(myTableName.initState));
callback(dat)
},

Realy need help. Thanks

Answers

  • allanallan Posts: 61,893Questions: 1Answers: 10,144 Site admin

    Hi,

    Thanks for getting in touch. I don't appear to have a trial or purchased license for your account on file. Could you let me know what account your Editor license was purchased with please?

    Thanks,
    Allan

  • LicassLicass Posts: 6Questions: 2Answers: 0
    edited April 2016

    I am the developer of user Pmengo Invoice #: 3094
    I as logged in as Pmengo but as you didnt answer my questions(maybe newbie questions) i start to post as another user account i had.
    I really need your help. cant fire the editor events after click save or create.
    Data is returned and seems ok.
    http://www.quad-systems.pt/QUAD_HCM/#ajax/datatablePROTO.php

    Please test an Update click pencil button

  • allanallan Posts: 61,893Questions: 1Answers: 10,144 Site admin

    Thanks for the clarification. Sorry I missed a couple of your questions from your other account! That was simply due to the volume of questions on this forum and I just missed your questions.

    The issue in this case is that you are using ajax with an override function:

        ajax: function (data, callback, settings) {
             myTableName.getData(myTableName.initState);
            //callback(dat)
        }
    

    That in itself is no problem, you can do that, as the documentation notes. The issue is that you aren't calling the callback function when the Ajax request is complete.

    You need to call that function so that Editor knows that the data has been updated, and therefore it can trigger the events that you are looking for.

    Please note that it must be given data in the format described in the manual.

    Regards,
    Allan

  • pmengopmengo Posts: 74Questions: 37Answers: 2

    VM205256:10 Uncaught TypeError: callback is not a function$.fn.dataTable.Editor.ajax @ VM205256:10Editor._ajax @ VM205076:4076Editor._submit @ VM205076:5072send @ VM205076:3399Editor.submit @ VM205076:3421btn.fn @ VM205076:2001(anonymous function) @ VM205076:2030n.event.dispatch @ jquery.min.js:3r.handle @ jquery.min.js:3
    VM205079:179 scrol up: 0 innerheight : 1240 1240

  • allanallan Posts: 61,893Questions: 1Answers: 10,144 Site admin

    Your editorEvents.js file currently contains:

            ajax: function (data, callback, settings) {
                myTableName.getData(myTableName.initState, this);
            },
    

    It doesn't look like the callback parameter is being used at all. You might need to pass it into your getData function if you need to use that function, and can it execute the callback when done.

    Allan

  • pmengopmengo Posts: 74Questions: 37Answers: 2

    i am using it in dev machine

  • allanallan Posts: 61,893Questions: 1Answers: 10,144 Site admin

    Can you put it live so I can attempt to debug the issue please.

    Allan

  • pmengopmengo Posts: 74Questions: 37Answers: 2
    edited April 2016

    ok.done . Thanks you very much

  • allanallan Posts: 61,893Questions: 1Answers: 10,144 Site admin

    Thanks - however, I still don't see the callback function being called in the ajax function you have defined:

            ajax: function (data, callback, settings) {
                myTableName.getData(myTableName.initState, this);
            },
    

    I've clear my browser's cache, so I don't think its a cache issue.

    One other thing I spotted - inside your preSubmit event handler you have:

                if ($("#teste").valid())
                    editor.submit()
                else
                    return false
    

    Calling submit() inside the preSubmit event handler isn't valid since it is already submitting. Just return; will do to allow the submit to complete.

    Allan

This discussion has been closed.